From 2d905e7c938bda49a2840c0da4a565e2b74b9291 Mon Sep 17 00:00:00 2001 From: dragongoose Date: Mon, 19 Feb 2024 11:21:18 -0500 Subject: [PATCH] legacy translation support --- src/i18n.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/i18n.ts b/src/i18n.ts index a594416..981b901 100644 --- a/src/i18n.ts +++ b/src/i18n.ts @@ -15,10 +15,21 @@ import uk from '@/locales/uk.json' import de from '@/locales/de.json' import zh_Hans from '@/locales/zh_Hans.json' +let locale = import.meta.env.SAFETWITCH_DEFAULT_LOCALE || 'en-US' +const fallbackLocale = import.meta.env.SAFETWITCH_FALLBACK_LOCALE || 'en-US' + +if (locale == 'en' ) { + locale = 'en-US' +} + +if (fallbackLocale == 'en' ) { + locale = 'en-US' +} + export default createI18n({ legacy: false, - locale: import.meta.env.SAFETWITCH_DEFAULT_LOCALE || 'en-US', - fallbackLocale: import.meta.env.SAFETWITCH_FALLBACK_LOCALE || 'en-US', + locale, + fallbackLocale, globalInjection: true, messages: { 'en-US': en,