This commit is contained in:
Rainer Simon 2020-05-20 18:32:51 +02:00
parent e26792d40a
commit 110f42b342
1 changed files with 5 additions and 5 deletions

View File

@ -79,13 +79,13 @@ export const addPolyfills = () => {
*/ */
export const setLocale = locale => { export const setLocale = locale => {
if (locale) { if (locale) {
try { const l = locale === 'auto' ?
const l = locale === 'auto' ? window.navigator.userLanguage || window.navigator.language : locale;
window.navigator.userLanguage || window.navigator.language : locale;
I18n.init(l); try {
I18n.init(l.split('-')[0].toLowerCase());
} catch (error) { } catch (error) {
console.warn(`Unsupported locale '${locale}'. Falling back to default en.`); console.warn(`Unsupported locale '${l}'. Falling back to default en.`);
} }
} }
} }