add temp browser locale getter

This commit is contained in:
Axolotle 2020-07-06 22:47:51 +02:00
parent 2f2c2ac683
commit d4e64bcc01

View file

@ -16,8 +16,19 @@ function loadLocaleMessages () {
return messages return messages
} }
function getBrowserLocale() {
const navigatorLocale = navigator.languages !== undefined
? navigator.languages[0]
: navigator.language
return !navigatorLocale
? undefined
: navigatorLocale
}
export default new VueI18n({ export default new VueI18n({
locale: process.env.VUE_APP_I18N_LOCALE || 'en', locale: getBrowserLocale(),
fallbackLocale: process.env.VUE_APP_I18N_FALLBACK_LOCALE || 'en', fallbackLocale: 'en',
// TODO : chunk locales json and lazy load them
messages: loadLocaleMessages() messages: loadLocaleMessages()
}) })