From 76474712a3928984fa22087129a8de6ec5636d98 Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Fri, 30 Jan 2026 21:57:12 +0100 Subject: [PATCH] Use BCP-47 language codes for i18n resource files Lingui expects the codes to be compliant to BCP-47 while weblate was not set up to create the resource files in that format. And react-i18next was able to just handle them. fixes #1058 --- lingui.config.ts | 4 ++-- src/base/IsoLanguages.ts | 4 ++-- src/i18n/index.ts | 4 ++-- src/i18n/locales/{zh_Hans.po => zh-Hans.po} | 0 src/i18n/locales/{zh_Hant.po => zh-Hant.po} | 0 5 files changed, 6 insertions(+), 6 deletions(-) rename src/i18n/locales/{zh_Hans.po => zh-Hans.po} (100%) rename src/i18n/locales/{zh_Hant.po => zh-Hant.po} (100%) diff --git a/lingui.config.ts b/lingui.config.ts index 233b4f19..d713e389 100644 --- a/lingui.config.ts +++ b/lingui.config.ts @@ -30,8 +30,8 @@ export default defineConfig({ 'ta', 'tr', 'vi', - 'zh_Hans', - 'zh_Hant', + 'zh-Hans', + 'zh-Hant', ], catalogs: [ { diff --git a/src/base/IsoLanguages.ts b/src/base/IsoLanguages.ts index a1203038..cf17b3c4 100644 --- a/src/base/IsoLanguages.ts +++ b/src/base/IsoLanguages.ts @@ -35,11 +35,11 @@ export const IsoLanguages: { [languageCode in I18nResourceCode]: ISOLanguage } & }, 'pt-br': PT_BR, 'pt-BR': PT_BR, - zh_Hans: { + 'zh-Hans': { name: 'Chinese (Simplified)', nativeName: '中文 (HANS)', }, - zh_Hant: { + 'zh-Hant': { name: 'Chinese (Traditional)', nativeName: '中文 (HANT)', }, diff --git a/src/i18n/index.ts b/src/i18n/index.ts index 6a9c46e0..078cd3f2 100644 --- a/src/i18n/index.ts +++ b/src/i18n/index.ts @@ -34,8 +34,8 @@ export const i18nResources = [ 'ta', 'tr', 'vi', - 'zh_Hans', - 'zh_Hant', + 'zh-Hans', + 'zh-Hant', ] as const; export type I18nResourceCode = (typeof i18nResources)[number]; diff --git a/src/i18n/locales/zh_Hans.po b/src/i18n/locales/zh-Hans.po similarity index 100% rename from src/i18n/locales/zh_Hans.po rename to src/i18n/locales/zh-Hans.po diff --git a/src/i18n/locales/zh_Hant.po b/src/i18n/locales/zh-Hant.po similarity index 100% rename from src/i18n/locales/zh_Hant.po rename to src/i18n/locales/zh-Hant.po