Skip to content

Commit

Permalink
uberf-7342: add french lang selector (hcengineering#5873)
Browse files Browse the repository at this point in the history
Signed-off-by: Alexey Zinoviev <alexey.zinoviev@xored.com>
  • Loading branch information
lexiv0re committed Jun 20, 2024
1 parent bb70f51 commit 1b9cf87
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 8 deletions.
4 changes: 2 additions & 2 deletions dev/prod/public/branding.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"localhost:8080": {
"title": "Platform",
"languages": "en,ru,pt,es,zh",
"languages": "en,ru,pt,es,zh,fr",
"defaultLanguage": "en",
"defaultApplication": "tracker",
"defaultSpace": "tracker:project:DefaultProject",
Expand Down Expand Up @@ -29,7 +29,7 @@
},
"localhost:8087": {
"title": "DevPlatform",
"languages": "en,ru,pt,es",
"languages": "en,ru,pt,es,zh,fr",
"defaultLanguage": "en",
"defaultApplication": "tracker",
"defaultSpace": "tracker:project:DefaultProject",
Expand Down
6 changes: 3 additions & 3 deletions dev/prod/src/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,11 @@ function configureI18n(): void {

export async function configurePlatform() {
setMetadata(platform.metadata.LoadHelper, async (loader) => {
for (let i = 0; i < 5; i++) {
for (let i = 0; i < 6; i++) {
try {
return loader()
} catch (err: any) {
if (err.message.includes('Loading chunk') && i != 4) {
if (err.message.includes('Loading chunk') && i != 5) {
continue
}
Analytics.handleError(err)
Expand Down Expand Up @@ -266,7 +266,7 @@ export async function configurePlatform() {
setMetadata(uiPlugin.metadata.DefaultApplication, login.component.LoginApp)

setMetadata(contactPlugin.metadata.LastNameFirst, myBranding.lastNameFirst === 'true' ?? false)
const languages = myBranding.languages ? (myBranding.languages as string).split(',').map((l) => l.trim()) : ['en', 'ru', 'es', 'pt', 'zh']
const languages = myBranding.languages ? (myBranding.languages as string).split(',').map((l) => l.trim()) : ['en', 'ru', 'es', 'pt', 'zh', 'fr']

setMetadata(uiPlugin.metadata.Languages, languages)
setMetadata(
Expand Down
1 change: 1 addition & 0 deletions packages/ui/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"Portuguese": "Português",
"Spanish": "Español",
"Chinese": "中文",
"French": "Français",
"MinutesBefore": "{minutes, plural, =1 {a minute before} other {# minutes before}}",
"HoursBefore": "{hours, plural, =1 {an hour before} other {# hours before}}",
"DaysBefore": "{days, plural, =1 {a day before} other {# days before}}",
Expand Down
1 change: 1 addition & 0 deletions packages/ui/lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"Portuguese": "Português",
"Spanish": "Español",
"Chinese": "中文",
"French": "Français",
"MinutesBefore": "{minutes, plural, =1 {un minuto antes} other {# minutos antes}}",
"HoursBefore": "{hours, plural, =1 {una hora antes} other {# horas antes}}",
"DaysBefore": "{days, plural, =1 {un día antes} other {# días antes}}",
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"DueDatePopupOverdueTitle": "Était à échéance le {value}",
"DueDatePopupDescription": "{value, plural, =0 {Aujourd'hui} =1 {Demain} other {# jours restants}}",
"DueDatePopupOverdueDescription": "{value, plural, =1 {1 jour de retard} other {# jours de retard}}",
"English": "Anglais",
"English": "English",
"Russian": "Русский",
"Portuguese": "Português",
"Spanish": "Español",
Expand Down
1 change: 1 addition & 0 deletions packages/ui/lang/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"Portuguese": "Português",
"Spanish": "Español",
"Chinese": "中文",
"French": "Français",
"MinutesBefore": "{minutes, plural, =1 {um minuto antes} other {# minutos antes}}",
"HoursBefore": "{hours, plural, =1 {uma hora antes} other {# horas antes}}",
"DaysBefore": "{days, plural, =1 {um dia antes} other {# dias antes}}",
Expand Down
1 change: 1 addition & 0 deletions packages/ui/lang/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"Spanish": "Español",
"Portuguese": "Português",
"Chinese": "中文",
"French": "Français",
"MinutesBefore": "{minutes, plural, =1 {за минуту} one {за # минуту} few {за # минуты} other {за # минут}}",
"HoursBefore": "{hours, plural, =1 {за час} one {за # час} few {за # часа} other {за # часов}}",
"DaysBefore": "{days, plural, =1 {за день} one {за # день} few {за # дня} other {за # дней}}",
Expand Down
1 change: 1 addition & 0 deletions packages/ui/lang/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"Portuguese": "Português",
"Spanish": "Español",
"Chinese": "中文",
"French": "Français",
"MinutesBefore": "{minutes, plural, =1 {一分钟前} other {# 分钟前}}",
"HoursBefore": "{hours, plural, =1 {一小时前} other {# 小时前}}",
"DaysBefore": "{days, plural, =1 {一天前} other {# 天前}}",
Expand Down
3 changes: 2 additions & 1 deletion packages/ui/src/components/internal/LangSelector.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
{ id: 'pt', label: ui.string.Portuguese, logo: '&#x1F1F5;&#x1F1F9;' },
{ id: 'es', label: ui.string.Spanish, logo: '&#x1F1EA;&#x1F1F8;' },
{ id: 'ru', label: ui.string.Russian, logo: '&#x1F1F7;&#x1F1FA;' },
{ id: 'zh', label: ui.string.Chinese, logo: '&#x1F1E8;&#x1F1F3;' }
{ id: 'zh', label: ui.string.Chinese, logo: '&#x1F1E8;&#x1F1F3;' },
{ id: 'fr', label: ui.string.French, logo: '&#x1F1EB;&#x1F1F7;' }
].filter((lang) => uiLangs.has(lang.id))
if (langs.findIndex((l) => l.id === currentLanguage) < 0 && langs.length !== 0) {
setLanguage(langs[0].id)
Expand Down
1 change: 1 addition & 0 deletions packages/ui/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export const uis = plugin(uiId, {
Spanish: '' as IntlString,
Portuguese: '' as IntlString,
Chinese: '' as IntlString,
French: '' as IntlString,
MinutesBefore: '' as IntlString,
HoursBefore: '' as IntlString,
DaysBefore: '' as IntlString,
Expand Down
2 changes: 1 addition & 1 deletion tests/branding-test.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"localhost:8083": {
"title": "Platform",
"languages": "en,ru,pt,es,zh",
"languages": "en,ru,pt,es,zh,fr",
"defaultLanguage": "en",
"defaultApplication": "tracker",
"defaultSpace": "tracker:project:DefaultProject",
Expand Down

0 comments on commit 1b9cf87

Please sign in to comment.