mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-25 11:16:31 -05:00
fix(i18n): use event to change luxon language setting
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
a23c215d8d
commit
53a3c92fdb
2 changed files with 4 additions and 3 deletions
|
@ -36,5 +36,6 @@ export const setUpI18n = async (): Promise<void> => {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
i18n.on('languageChanged', (language) => (Settings.defaultLocale = language))
|
||||||
Settings.defaultLocale = i18n.language
|
Settings.defaultLocale = i18n.language
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,9 +65,9 @@ export const LanguagePicker: React.FC = () => {
|
||||||
|
|
||||||
const onChangeLang = useCallback(
|
const onChangeLang = useCallback(
|
||||||
(event: React.ChangeEvent<HTMLSelectElement>) => {
|
(event: React.ChangeEvent<HTMLSelectElement>) => {
|
||||||
const language = event.currentTarget.value
|
i18n
|
||||||
Settings.defaultLocale = language
|
.changeLanguage(event.currentTarget.value)
|
||||||
i18n.changeLanguage(language).catch((error: Error) => log.error('Error while switching language', error))
|
.catch((error: Error) => log.error('Error while switching language', error))
|
||||||
},
|
},
|
||||||
[i18n]
|
[i18n]
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue