mirror of
https://github.com/jumpserver/lina.git
synced 2025-08-07 09:45:02 +00:00
feat: i18n获取浏览器默认语言
This commit is contained in:
parent
ec2674a956
commit
07036cdea7
@ -7,11 +7,12 @@ import date from './date'
|
|||||||
import VueCookie from 'vue-cookie'
|
import VueCookie from 'vue-cookie'
|
||||||
|
|
||||||
Vue.use(VueI18n)
|
Vue.use(VueI18n)
|
||||||
|
const cookieLang = VueCookie.get('django_language')
|
||||||
const cookieLang = VueCookie.get('django_language') || 'en'
|
const browserLang = navigator.systemLanguage || navigator.language
|
||||||
const defaultLang = cookieLang.slice(0, 2)
|
let lang = cookieLang || browserLang || 'zh'
|
||||||
|
lang = lang.slice(0, 2)
|
||||||
const i18n = new VueI18n({
|
const i18n = new VueI18n({
|
||||||
locale: defaultLang,
|
locale: lang,
|
||||||
fallbackLocale: 'en',
|
fallbackLocale: 'en',
|
||||||
silentFallbackWarn: true,
|
silentFallbackWarn: true,
|
||||||
silentTranslationWarn: true,
|
silentTranslationWarn: true,
|
||||||
|
Loading…
Reference in New Issue
Block a user