中英文切换
This commit is contained in:
@@ -1,22 +1,28 @@
|
||||
import Vue from 'vue'
|
||||
import VueI18n from 'vue-i18n'
|
||||
import enLocale from 'element-ui/lib/locale/lang/en'
|
||||
import zhLocale from 'element-ui/lib/locale/lang/zh-CN'
|
||||
import locale from 'element-ui/lib/locale'
|
||||
import zh from './langs/zh'
|
||||
import en from './langs/en'
|
||||
import enLocale from 'element-ui/lib/locale/lang/en'
|
||||
import zhLocale from 'element-ui/lib/locale/lang/zh-CN'
|
||||
|
||||
Vue.use(VueI18n)
|
||||
|
||||
// 引入本地包
|
||||
const messages = {
|
||||
en: Object.assign(en, enLocale),
|
||||
zh: Object.assign(zh, zhLocale)
|
||||
'en-US': Object.assign(en, enLocale),
|
||||
'en': Object.assign(en, enLocale),
|
||||
'zh-CN': Object.assign(zh, zhLocale),
|
||||
'zh': Object.assign(zh, zhLocale)
|
||||
}
|
||||
|
||||
// console.log(messages.zh)
|
||||
|
||||
const navLang = navigator.language || navigator.userLanguage
|
||||
let localLang = navLang || false
|
||||
let lang = localLang || window.localStorage.getItem('locale') || 'zh-CN'
|
||||
lang = 'zh-CN'
|
||||
// 创建国际化实例
|
||||
const i18n = new VueI18n({
|
||||
locale: localStorage.getItem('locale') || 'zh',
|
||||
locale: lang,
|
||||
messages
|
||||
})
|
||||
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
module.exports = {
|
||||
message: {
|
||||
title: 'Sport Brands'
|
||||
},
|
||||
top: {
|
||||
run: 'run',
|
||||
auto: 'auto'
|
||||
login: {
|
||||
passwordlogin: 'Password login',
|
||||
configuration: 'Configuration',
|
||||
username: 'Username',
|
||||
password: 'Password',
|
||||
domainnameaddress: 'Domain name address',
|
||||
refreshtime: 'Refresh time(s)',
|
||||
login: 'Login'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
module.exports = {
|
||||
message: {
|
||||
title: '运动品牌'
|
||||
},
|
||||
top: {
|
||||
run: '运行',
|
||||
auto: '自动'
|
||||
login: {
|
||||
passwordlogin: '密码登录',
|
||||
configuration: '配置',
|
||||
username: '用户名',
|
||||
password: '密码',
|
||||
domainnameaddress: '域名地址',
|
||||
refreshtime: '刷新时间(秒)',
|
||||
login: '登录'
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user