Enable and fix pt and es languages (#4792)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev 2024-02-27 23:53:16 +07:00 committed by GitHub
parent 604e37576a
commit 1967e8e5dc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
41 changed files with 19 additions and 10 deletions

View File

@ -164,7 +164,7 @@ export async function configurePlatform() {
setMetadata(uiPlugin.metadata.SearchPopup, view.component.ActionsPopup)
setMetadata(contactPlugin.metadata.LastNameFirst, config.LAST_NAME_FIRST === 'true' ?? false)
const languages = config.LANGUAGES ? (config.LANGUAGES as string).split(',').map((l) => l.trim()) : ['en', 'ru']
const languages = config.LANGUAGES ? (config.LANGUAGES as string).split(',').map((l) => l.trim()) : ['en', 'ru', 'es', 'pt']
setMetadata(uiPlugin.metadata.Languages, languages)
setMetadata(

View File

@ -45,7 +45,6 @@
"prettier": "^3.1.0",
"typescript": "^5.3.3",
"@types/ws": "^8.5.3",
"@types/xml2js": "~0.4.9",
"@types/mime-types": "~2.1.1",
"@types/request": "~2.48.8",
"jest": "^29.7.0",
@ -134,7 +133,6 @@
"libphonenumber-js": "^1.9.46",
"mime-types": "~2.1.34",
"mongodb": "^6.3.0",
"ws": "^8.10.0",
"xml2js": "~0.4.23"
"ws": "^8.10.0"
}
}

View File

@ -70,10 +70,14 @@ async function loadTranslationsForComponent (plugin: Plugin, locale: string): Pr
try {
return (await loader(locale)) as Record<string, IntlString> | Status
} catch (err) {
console.error(err)
const status = unknownError(err)
await setPlatformStatus(status)
return status
console.error('No translations found for plugin', plugin, err)
try {
return (await loader('en')) as Record<string, IntlString> | Status
} catch (err: any) {
const status = unknownError(err)
await setPlatformStatus(status)
return status
}
}
}

View File

@ -82,6 +82,8 @@
"ThemeDark": "Dark",
"ThemeSystem": "System",
"NoTimeZonesFound": "No time zones found",
"Selected": "Selected:"
"Selected": "Selected:",
"Spanish": "Spanish",
"Portuguese": "Portuguese"
}
}

View File

@ -48,6 +48,8 @@
"DueDatePopupOverdueDescription": "{value, plural, one {# день опоздания} few {# дня опоздания} other {# дней опоздания}}",
"English": "Английский",
"Russian": "Русский",
"Spanish": "Испанский",
"Portuguese": "Португальский",
"MinutesBefore": "{minutes, plural, =1 {за минуту} one {за # минуту} few {за # минуты} other {за # минут}}",
"HoursBefore": "{hours, plural, =1 {за час} one {за # час} few {за # часа} other {за # часов}}",
"DaysBefore": "{days, plural, =1 {за день} one {за # день} few {за # дня} other {за # дней}}",

View File

@ -26,9 +26,10 @@
const uiLangs = new Set(getMetadata(ui.metadata.Languages))
const langs = [
{ id: 'en', label: ui.string.English, logo: '&#x1F1FA;&#x1F1F8;' },
{ 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;' }
].filter((lang) => uiLangs.has(lang.id))
if (langs.findIndex((l) => l.id === currentLanguage) < 0 && langs.length !== 0) {
setLanguage(langs[0].id)
}

View File

@ -69,6 +69,8 @@ export const uis = plugin(uiId, {
NeedsToBeCompletedByThisDate: '' as IntlString,
English: '' as IntlString,
Russian: '' as IntlString,
Spanish: '' as IntlString,
Portuguese: '' as IntlString,
MinutesBefore: '' as IntlString,
HoursBefore: '' as IntlString,
DaysBefore: '' as IntlString,