|
@@ -1,9 +1,9 @@
|
|
|
import Vue from 'vue'
|
|
|
import VueI18n from 'vue-i18n'
|
|
|
import elementEnLocale from 'element-ui/lib/locale/lang/en' // element-ui lang导入Element的语言包 英文
|
|
|
-import elementZhLocale from 'element-ui/lib/locale/lang/zh-CN'// element-ui lang g导入Element的语言包 中文
|
|
|
+import elementZhLocale from 'element-ui/lib/locale/lang/zh-CN' // element-ui lang g导入Element的语言包 中文
|
|
|
import enLocale from './en' // 导入项目中用到的英文语言包
|
|
|
-import zhLocale from './zh'// 导入项目中用到的中文语言包
|
|
|
+import zhLocale from './zh' // 导入项目中用到的中文语言包
|
|
|
Vue.use(VueI18n)
|
|
|
const messages = {
|
|
|
en: {
|
|
@@ -18,10 +18,10 @@ const messages = {
|
|
|
}
|
|
|
|
|
|
const i18n = new VueI18n({
|
|
|
- locale: localStorage.getItem('language') || 'zh', // 设置当前语种,之所以放到storage中是为了避免用户手动点击刷新页面时语言被自动切换回去,所以需要把语言存起来
|
|
|
+ locale: localStorage.getItem('language') || process.env.VUE_APP_DEF_LANGUAGE, // 设置当前语种,之所以放到storage中是为了避免用户手动点击刷新页面时语言被自动切换回去,所以需要把语言存起来
|
|
|
messages, // 设置全局当地语言包,
|
|
|
- fallbackLocale: 'zh', //如果当前语种不存在时,默认设置当前语种
|
|
|
- numberFormats:{ //设置 数字本地化
|
|
|
+ fallbackLocale: process.env.VUE_APP_DEF_LANGUAGE, //如果当前语种不存在时,默认设置当前语种
|
|
|
+ numberFormats: { //设置 数字本地化
|
|
|
'en': {
|
|
|
currency: { //添加 $
|
|
|
style: 'currency', currency: 'USD'
|
|
@@ -33,7 +33,7 @@ const i18n = new VueI18n({
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- dateTimeFormats:{//设置 日期时间本地化
|
|
|
+ dateTimeFormats: {//设置 日期时间本地化
|
|
|
'en': {
|
|
|
short: {
|
|
|
year: 'numeric', month: 'short', day: 'numeric'
|