fix: Frontend translation library expects dash separated, not underscore separated languages – this fix is required to enable working pluralization

This commit is contained in:
Tom Moor
2021-01-31 14:40:50 -08:00
parent ef6ce72cf5
commit 9d84652dff
2 changed files with 40 additions and 30 deletions

View File

@@ -21,7 +21,9 @@ const Authenticated = ({ children }: Props) => {
// the user available and means we can start loading translations faster
React.useEffect(() => {
if (i18n.language !== language) {
i18n.changeLanguage(language);
// Languages are stored in en_US format in the database, however the
// frontend translation framework (i18next) expects en-US
i18n.changeLanguage(language.replace("_", "-"));
}
}, [i18n, language]);