mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
add temp browser locale getter
This commit is contained in:
parent
2f2c2ac683
commit
d4e64bcc01
1 changed files with 13 additions and 2 deletions
|
@ -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()
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue