diff options
author | Eric Bailey <git@esb.lol> | 2023-12-11 17:34:18 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-11 15:34:18 -0800 |
commit | bae63f9bf0dbc40dd7ea99fde714e92b9fc83dc3 (patch) | |
tree | 8b4d06030dbd0603edb9345ba55c64eea44d4191 /src/locale/helpers.ts | |
parent | 3592f6f50b98c6bc81ebbf50f11f85df23376e53 (diff) | |
download | voidsky-bae63f9bf0dbc40dd7ea99fde714e92b9fc83dc3.tar.zst |
Patch bad migration, sanitize bad value (#2179)
Diffstat (limited to 'src/locale/helpers.ts')
-rw-r--r-- | src/locale/helpers.ts | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/locale/helpers.ts b/src/locale/helpers.ts index 65db32f2f..4d01459ab 100644 --- a/src/locale/helpers.ts +++ b/src/locale/helpers.ts @@ -84,3 +84,15 @@ export function getTranslatorLink(text: string, lang: string): string { text, )}` } + +export function sanitizeAppLanguageSetting(appLanguage: string) { + const langs = appLanguage.split(',').filter(Boolean) + + for (const lang of langs) { + if (['en', 'hi'].includes(lang)) { + return lang + } + } + + return 'en' +} |