This commit is contained in:
Tom Moor
2023-09-07 22:36:10 -04:00
parent bb555de1ba
commit d8bfb0fe5d
2 changed files with 44 additions and 15 deletions

View File

@@ -12,13 +12,13 @@ export async function changeLanguage(
toLanguageString: string | null | undefined,
i18n: i18n
) {
// Languages are stored in en_US format in the database, however the
// frontend translation framework (i18next) expects en-US
const locale = toLanguageString
? unicodeCLDRtoBCP47(toLanguageString)
: undefined;
if (locale && i18n.languages?.[0] !== locale) {
// Languages are stored in en_US format in the database, however the
// frontend translation framework (i18next) expects en-US
await i18n.changeLanguage(locale);
await Desktop.bridge?.setSpellCheckerLanguages(["en-US", locale]);
}