fix(i18n): use event to change luxon language setting

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
Tilman Vatteroth 2023-04-28 18:29:16 +02:00
parent a23c215d8d
commit 53a3c92fdb
2 changed files with 4 additions and 3 deletions

View file

@ -36,5 +36,6 @@ export const setUpI18n = async (): Promise<void> => {
}
})
i18n.on('languageChanged', (language) => (Settings.defaultLocale = language))
Settings.defaultLocale = i18n.language
}

View file

@ -65,9 +65,9 @@ export const LanguagePicker: React.FC = () => {
const onChangeLang = useCallback(
(event: React.ChangeEvent<HTMLSelectElement>) => {
const language = event.currentTarget.value
Settings.defaultLocale = language
i18n.changeLanguage(language).catch((error: Error) => log.error('Error while switching language', error))
i18n
.changeLanguage(event.currentTarget.value)
.catch((error: Error) => log.error('Error while switching language', error))
},
[i18n]
)