From f36f82418b5f2139226970434194bd711c1dcda0 Mon Sep 17 00:00:00 2001 From: Cesar E Garza Date: Wed, 22 May 2024 20:10:54 -0500 Subject: [PATCH] Update supported_languages.js with new language metadata --- scripts/i18n.py | 15 ++++++++++ .../src/components/supported_languages.js | 28 +++++++++++-------- 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/scripts/i18n.py b/scripts/i18n.py index 0ad2804..205c1a1 100755 --- a/scripts/i18n.py +++ b/scripts/i18n.py @@ -124,6 +124,21 @@ def update_supported_languages(lang_metadata: dict) -> None: write_supported_languages(supported_languages) + # Update supported_languages.js + supported_languages_js = {} + for metadata in lang_metadata.values(): + key = metadata["splatoonLanguageKey"] + supported_languages_js[key] = metadata["languageNames"] + + with open(REACT_SUPPLANG_FILE, "w") as f: + f.write( + "const SUPPORTED_LANGUAGES = " + + orjson.dumps( + supported_languages_js, option=orjson.OPT_INDENT_2 + ).decode() + + ";\n\nexport default SUPPORTED_LANGUAGES;\n" + ) + def update_i18n_js(lang_metadata: dict) -> None: with open(REACT_I18N_FILE, "r") as f: diff --git a/src/react_app/src/components/supported_languages.js b/src/react_app/src/components/supported_languages.js index d8f1490..0bf252a 100644 --- a/src/react_app/src/components/supported_languages.js +++ b/src/react_app/src/components/supported_languages.js @@ -1,13 +1,19 @@ -// IF YOU ADD A NEW LANGUAGE, YOU MUST ADD IT TO THE SUPPORTED_LANGUAGES OBJECT const SUPPORTED_LANGUAGES = { - "en": { - "en": "English", - "es": "Spanish" - }, - "es": { - "en": "Inglés", - "es": "Español" - } -} + "USen": { + "USen": "English (US)", + "USes": "Spanish (NA)", + "EUen": "English (UK)" + }, + "EUen": { + "USen": "English (US)", + "USes": "Spanish (NA)", + "EUen": "English (UK)" + }, + "USes": { + "USen": "Inglés (EEUU)", + "USes": "Español (LATAM)", + "EUen": "Inglés (RU)" + } +}; -export default SUPPORTED_LANGUAGES; \ No newline at end of file +export default SUPPORTED_LANGUAGES;