From 34c1aebda6e26e4557cffd124f03420659cb0aee Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Thu, 18 Jan 2024 21:54:00 -0800 Subject: [PATCH] Add catalan --- lingui.config.js | 14 +++++++++++++- src/locale/helpers.ts | 2 ++ src/locale/i18n.ts | 5 +++++ src/locale/i18n.web.ts | 4 ++++ src/locale/languages.ts | 2 ++ 5 files changed, 26 insertions(+), 1 deletion(-) diff --git a/lingui.config.js b/lingui.config.js index 882c4877..0659bd07 100644 --- a/lingui.config.js +++ b/lingui.config.js @@ -1,6 +1,18 @@ /** @type {import('@lingui/conf').LinguiConfig} */ module.exports = { - locales: ['en', 'de', 'es', 'fr', 'hi', 'id', 'ja', 'ko', 'pt-BR', 'uk'], + locales: [ + 'en', + 'de', + 'es', + 'fr', + 'hi', + 'id', + 'ja', + 'ko', + 'pt-BR', + 'uk', + 'ca', + ], catalogs: [ { path: '/src/locale/locales/{locale}/messages', diff --git a/src/locale/helpers.ts b/src/locale/helpers.ts index 8b3bf5f3..dddd6855 100644 --- a/src/locale/helpers.ts +++ b/src/locale/helpers.ts @@ -137,6 +137,8 @@ export function sanitizeAppLanguageSetting(appLanguage: string): AppLanguage { return AppLanguage.pt_BR case 'uk': return AppLanguage.uk + case 'ca': + return AppLanguage.ca default: continue } diff --git a/src/locale/i18n.ts b/src/locale/i18n.ts index 88ae10b6..d0bc828c 100644 --- a/src/locale/i18n.ts +++ b/src/locale/i18n.ts @@ -13,6 +13,7 @@ import {messages as messagesJa} from '#/locale/locales/ja/messages' import {messages as messagesKo} from '#/locale/locales/ko/messages' import {messages as messagesPt_BR} from '#/locale/locales/pt-BR/messages' import {messages as messagesUk} from '#/locale/locales/uk/messages' +import {messages as messagesCa} from '#/locale/locales/ca/messages' import {sanitizeAppLanguageSetting} from '#/locale/helpers' import {AppLanguage} from '#/locale/languages' @@ -59,6 +60,10 @@ export async function dynamicActivate(locale: AppLanguage) { i18n.loadAndActivate({locale, messages: messagesUk}) break } + case AppLanguage.ca: { + i18n.loadAndActivate({locale, messages: messagesCa}) + break + } default: { i18n.loadAndActivate({locale, messages: messagesEn}) break diff --git a/src/locale/i18n.web.ts b/src/locale/i18n.web.ts index a6f0e158..de5e5aa7 100644 --- a/src/locale/i18n.web.ts +++ b/src/locale/i18n.web.ts @@ -49,6 +49,10 @@ export async function dynamicActivate(locale: AppLanguage) { mod = await import(`./locales/uk/messages`) break } + case AppLanguage.ca: { + mod = await import(`./locales/ca/messages`) + break + } default: { mod = await import(`./locales/en/messages`) break diff --git a/src/locale/languages.ts b/src/locale/languages.ts index c6799816..7b19fbe2 100644 --- a/src/locale/languages.ts +++ b/src/locale/languages.ts @@ -16,6 +16,7 @@ export enum AppLanguage { ko = 'ko', pt_BR = 'pt-BR', uk = 'uk', + ca = 'ca', } interface AppLanguageConfig { @@ -35,6 +36,7 @@ export const APP_LANGUAGES: AppLanguageConfig[] = [ {code2: AppLanguage.ko, name: '한국어'}, {code2: AppLanguage.pt_BR, name: 'Português (BR)'}, {code2: AppLanguage.uk, name: 'Українська'}, + {code2: AppLanguage.ca, name: 'Catalan'}, ] export const LANGUAGES: Language[] = [