From 4ece55d6e9339dae763c378247766fa2322780b6 Mon Sep 17 00:00:00 2001 From: Bennie Rosas Date: Tue, 4 Jun 2024 22:27:28 -0500 Subject: [PATCH] update language locales (#1791) * update language locales * change Greek from 'gr' to 'el'; update language matching logic * fix test --- client-participation/js/strings.js | 155 ++++++++---------- .../js/strings/{fy_NL => fy_nl.js} | 0 .../js/strings/ta.js | 0 .../e2e/client-participation/i18n.cy.js | 24 ++- e2e/cypress/support/helpers.js | 7 +- 5 files changed, 95 insertions(+), 91 deletions(-) rename client-participation/js/strings/{fy_NL => fy_nl.js} (100%) rename ta.js => client-participation/js/strings/ta.js (100%) diff --git a/client-participation/js/strings.js b/client-participation/js/strings.js index cc15f4606..e22e972db 100644 --- a/client-participation/js/strings.js +++ b/client-participation/js/strings.js @@ -4,68 +4,59 @@ var preloadHelper = require("./util/preloadHelper"); var Utils = require("./util/utils"); var translations = { - en_us: require("./strings/en_us.js"), - // ja: require("./strings/ja.js"), - - // zh-Hant is Traditional Chinese (TW, MO and HK can use the same file.) - zh_Hant: require("./strings/zh_Hant.js"), - - // zh-Hans is Simplified Chinese. (CN, SG and MY can use the same file.) - zh_Hans: require("./strings/zh_Hans.js"), - + // Arabic + ar: require("./strings/ar.js"), + // Welsh + cy: require("./strings/cy.js"), // Danish da: require("./strings/da_dk.js"), - // German de: require("./strings/de_de.js"), - + // Greek + el: require("./strings/gr.js"), + // English + en_us: require("./strings/en_us.js"), // Spanish es: require("./strings/es_la.js"), - // Farsi fa: require("./strings/fa.js"), - // French fr: require("./strings/fr.js"), - + // Frisian + fy: require("./strings/fy_nl.js"), + // Hebrew + he: require("./strings/he.js"), + // Croatian + hr: require("./strings/hr.js"), // Italian it: require("./strings/it.js"), - + // Japanese + ja: require("./strings/ja.js"), // Dutch nl: require("./strings/nl.js"), - + // Portuguese // Brazilian Portuguese (all portuguese speakers are temporarily using the same file.) pt_br: require("./strings/pt_br.js"), - - // Japanese - ja: require("./strings/ja.js"), - - // Croatian - hr: require("./strings/hr.js"), - + // Portuguese (Timor-Leste) + // pt_tl: require("./strings/pt_tl.js"), + // Romanian & Moldovan + ro: require("./strings/ro.js"), + // Russian + ru: require("./strings/ru.js"), // Slovak sk: require("./strings/sk.js"), - - // Hebrew - he: require("./strings/he.js"), - - // Welsh - cy: require("./strings/cy.js"), - - // Greek - gr: require("./strings/gr.js"), - + // Tamil + ta: require("./strings/ta.js"), + // Tetum (Timor) + tdt: require("./strings/tdt.js"), // Ukrainian uk: require("./strings/uk.js"), - - // Russian - ru: require("./strings/ru.js"), - - // Romanian & Moldovan - ro: require("./strings/ro.js"), - - // Arabic - ar: require("./strings/ar.js"), + // Chinese + // zh-Hans is Simplified Chinese. (CN, SG and MY can use the same file.) + zh_Hans: require("./strings/zh_Hans.js"), + // Chinese (Taiwan) + // zh-Hant is Traditional Chinese (TW, MO and HK can use the same file.) + zh_Hant: require("./strings/zh_Hant.js"), }; @@ -85,75 +76,63 @@ preloadHelper.acceptLanguagePromise.then(function() { prioritized.reverse(); - prioritized.forEach(function(languageCode) { + prioritized.forEach(function (languageCode) { if (languageCode.match(/^en/)) { _.extend(strings, translations.en_us); - } - else if (languageCode.match(/^ja/)) { + } else if (languageCode.match(/^ja/)) { _.extend(strings, translations.ja); - } - else if ( + } else if ( languageCode.match(/^zh-CN/) || languageCode.match(/^zh-SG/) || - languageCode.match(/^zh-MY/)) { + languageCode.match(/^zh-MY/) + ) { _.extend(strings, translations.zh_Hans); - } - else if (languageCode.match(/^zh/)) { // TW, MO and HK + } else if (languageCode.match(/^zh/)) { _.extend(strings, translations.zh_Hant); - } - else if (languageCode.match(/^it/)) { + } else if (languageCode.match(/^it/)) { _.extend(strings, translations.it); - } - else if (languageCode.match(/^da/)) { + } else if (languageCode.match(/^da/)) { _.extend(strings, translations.da); - } - else if (languageCode.match(/^de/)) { + } else if (languageCode.match(/^de/)) { _.extend(strings, translations.de); - } - else if (languageCode.match(/^es/)) { + } else if (languageCode.match(/^es/)) { _.extend(strings, translations.es); - } - else if (languageCode.match(/^fa/)) { + } else if (languageCode.match(/^fa/)) { _.extend(strings, translations.fa); - } - else if (languageCode.match(/^fr/)) { + } else if (languageCode.match(/^fr/)) { _.extend(strings, translations.fr); - } - else if (languageCode.match(/^nl/)) { + } else if (languageCode.match(/^nl/)) { _.extend(strings, translations.nl); - } - else if (languageCode.match(/^sk/)) { + } else if (languageCode.match(/^sk/)) { _.extend(strings, translations.sk); - } - else if ( - languageCode.match(/^pt/) || // To help other Portuguese speaker participants until its specific translation is not here - languageCode.match(/^pt-PT/) || // To help Portuguese participantes until an specific translation is not here - languageCode.match(/^pt-BR/)) { + } else if ( + languageCode.match(/^pt/) || // To help Portuguese participants until a specific translation is here + languageCode.match(/^pt-PT/) || // To help Portuguese participants until a specific translation is here + languageCode.match(/^pt-BR/) + ) { _.extend(strings, translations.pt_br); - } - else if (languageCode.match(/^he/)) { + } else if (languageCode.match(/^he/)) { _.extend(strings, translations.he); - } - else if (languageCode.match(/^cy/)) { + } else if (languageCode.match(/^cy/)) { _.extend(strings, translations.cy); - } - else if (languageCode.match(/^gr/)) { - _.extend(strings, translations.gr); - } - else if (languageCode.match(/^uk/)) { + } else if (languageCode.match(/^el/)) { + _.extend(strings, translations.el); + } else if (languageCode.match(/^uk/)) { _.extend(strings, translations.uk); - } - else if (languageCode.match(/^ru/)) { + } else if (languageCode.match(/^ru/)) { _.extend(strings, translations.ru); - } - else if (languageCode.match(/^ro/)) { + } else if (languageCode.match(/^ro/)) { _.extend(strings, translations.ro); - } - else if (languageCode.match(/^hr/)) { + } else if (languageCode.match(/^hr/)) { _.extend(strings, translations.hr); - } - else if (languageCode.match(/^ar/)) { + } else if (languageCode.match(/^ar/)) { _.extend(strings, translations.ar); + } else if (languageCode.match(/^fy/)) { + _.extend(strings, translations.fy); + } else if (languageCode.match(/^ta/)) { + _.extend(strings, translations.ta); + } else if (languageCode.match(/^tdt/)) { + _.extend(strings, translations.tdt); } }); }); diff --git a/client-participation/js/strings/fy_NL b/client-participation/js/strings/fy_nl.js similarity index 100% rename from client-participation/js/strings/fy_NL rename to client-participation/js/strings/fy_nl.js diff --git a/ta.js b/client-participation/js/strings/ta.js similarity index 100% rename from ta.js rename to client-participation/js/strings/ta.js diff --git a/e2e/cypress/e2e/client-participation/i18n.cy.js b/e2e/cypress/e2e/client-participation/i18n.cy.js index f40b90d07..819114b69 100644 --- a/e2e/cypress/e2e/client-participation/i18n.cy.js +++ b/e2e/cypress/e2e/client-participation/i18n.cy.js @@ -12,6 +12,10 @@ describe('Interface internationalization', function () { cy.ensureConversation() }) + it('translates into Arabic', function () { + checkTranslation('ar', this.convoId) + }) + it('translates into Welsh', function () { checkTranslation('cy', this.convoId) }) @@ -24,6 +28,10 @@ describe('Interface internationalization', function () { checkTranslation('de', this.convoId) }) + it('translates into Greek', function () { + checkTranslation('el', this.convoId) + }) + it('translates into English', function () { checkTranslation('en', this.convoId) }) @@ -40,8 +48,8 @@ describe('Interface internationalization', function () { checkTranslation('fr', this.convoId) }) - it('translates into Greek', function () { - checkTranslation('gr', this.convoId) + it('translates into Frisian', function () { + checkTranslation('fy', this.convoId) }) it('translates into Hebrew', function () { @@ -68,6 +76,10 @@ describe('Interface internationalization', function () { checkTranslation('pt', this.convoId) }) + it('translates into Romanian', function () { + checkTranslation('ro', this.convoId) + }) + it('translates into Russian', function () { checkTranslation('ru', this.convoId) }) @@ -76,6 +88,14 @@ describe('Interface internationalization', function () { checkTranslation('sk', this.convoId) }) + it('translates into Tamil', function () { + checkTranslation('ta', this.convoId) + }) + + it('translates into Tetum', function () { + checkTranslation('tdt', this.convoId) + }) + it('translates into Ukrainian', function () { checkTranslation('uk', this.convoId) }) diff --git a/e2e/cypress/support/helpers.js b/e2e/cypress/support/helpers.js index b7f13cb00..6a38cae94 100644 --- a/e2e/cypress/support/helpers.js +++ b/e2e/cypress/support/helpers.js @@ -34,22 +34,27 @@ export function readTranslation(lang, key = 'writePrompt') { const locales = { // : + ar: 'ar', cy: 'cy', da: 'da_dk', de: 'de_de', en: 'en_us', + el: 'gr', es: 'es_la', fa: 'fa', fr: 'fr', - gr: 'gr', + fy: 'fy_nl', he: 'he', hr: 'hr', it: 'it', ja: 'ja', nl: 'nl', pt: 'pt_br', + ro: 'ro', ru: 'ru', sk: 'sk', + ta: 'ta', + tdt: 'tdt', uk: 'uk', 'zh-CN': 'zh_Hans', 'zh-TW': 'zh_Hant',