style: 全局代码格式化
Former-commit-id: bb50c8419b8fcdeb48c93fce9f399d901e8f5a52
This commit is contained in:
@@ -1,24 +1,24 @@
|
||||
export default {
|
||||
// 路由国际化
|
||||
route: {
|
||||
dashboard: 'Dashboard',
|
||||
document: 'Document'
|
||||
},
|
||||
// 登录页面国际化
|
||||
login: {
|
||||
title: 'vue3-element-admin',
|
||||
username: 'Username',
|
||||
password: 'Password',
|
||||
login: 'Login',
|
||||
code: 'Verification Code',
|
||||
copyright: '',
|
||||
icp: ''
|
||||
},
|
||||
// 导航栏国际化
|
||||
navbar:{
|
||||
dashboard: 'Dashboard',
|
||||
logout:'Logout',
|
||||
document:'Document',
|
||||
gitee:'Gitee'
|
||||
}
|
||||
}
|
||||
// 路由国际化
|
||||
route: {
|
||||
dashboard: 'Dashboard',
|
||||
document: 'Document'
|
||||
},
|
||||
// 登录页面国际化
|
||||
login: {
|
||||
title: 'vue3-element-admin',
|
||||
username: 'Username',
|
||||
password: 'Password',
|
||||
login: 'Login',
|
||||
code: 'Verification Code',
|
||||
copyright: '',
|
||||
icp: ''
|
||||
},
|
||||
// 导航栏国际化
|
||||
navbar: {
|
||||
dashboard: 'Dashboard',
|
||||
logout: 'Logout',
|
||||
document: 'Document',
|
||||
gitee: 'Gitee'
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,46 +1,45 @@
|
||||
|
||||
// 自定义国际化配置
|
||||
import {createI18n} from 'vue-i18n'
|
||||
import {localStorage} from '@/utils/storage'
|
||||
import { createI18n } from 'vue-i18n';
|
||||
import { localStorage } from '@/utils/storage';
|
||||
|
||||
// 本地语言包
|
||||
import enLocale from './en'
|
||||
import zhCnLocale from './zh-cn'
|
||||
import enLocale from './en';
|
||||
import zhCnLocale from './zh-cn';
|
||||
|
||||
const messages = {
|
||||
'zh-cn': {
|
||||
...zhCnLocale
|
||||
},
|
||||
en: {
|
||||
...enLocale
|
||||
}
|
||||
}
|
||||
'zh-cn': {
|
||||
...zhCnLocale
|
||||
},
|
||||
en: {
|
||||
...enLocale
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 获取当前系统使用语言字符串
|
||||
*
|
||||
*
|
||||
* @returns zh-cn|en ...
|
||||
*/
|
||||
export const getLanguage = () => {
|
||||
// 本地缓存获取
|
||||
let language = localStorage.get('language')
|
||||
if (language) {
|
||||
return language
|
||||
}
|
||||
// 浏览器使用语言
|
||||
language = navigator.language.toLowerCase()
|
||||
const locales = Object.keys(messages)
|
||||
for (const locale of locales) {
|
||||
if (language.indexOf(locale) > -1) {
|
||||
return locale
|
||||
}
|
||||
}
|
||||
return 'zh-cn'
|
||||
}
|
||||
// 本地缓存获取
|
||||
let language = localStorage.get('language');
|
||||
if (language) {
|
||||
return language;
|
||||
}
|
||||
// 浏览器使用语言
|
||||
language = navigator.language.toLowerCase();
|
||||
const locales = Object.keys(messages);
|
||||
for (const locale of locales) {
|
||||
if (language.indexOf(locale) > -1) {
|
||||
return locale;
|
||||
}
|
||||
}
|
||||
return 'zh-cn';
|
||||
};
|
||||
|
||||
const i18n = createI18n({
|
||||
locale: getLanguage(),
|
||||
messages: messages
|
||||
})
|
||||
locale: getLanguage(),
|
||||
messages: messages
|
||||
});
|
||||
|
||||
export default i18n
|
||||
export default i18n;
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
export default {
|
||||
// 路由国际化
|
||||
route: {
|
||||
dashboard: '首页',
|
||||
document: '项目文档'
|
||||
},
|
||||
// 登录页面国际化
|
||||
login:{
|
||||
title: 'vue3-element-admin',
|
||||
username:'用户名',
|
||||
password:'密码',
|
||||
login:'登 录',
|
||||
code:'请输入验证码',
|
||||
copyright:'',
|
||||
icp:''
|
||||
},
|
||||
navbar:{
|
||||
dashboard: '首页',
|
||||
logout:'注销',
|
||||
document:'项目文档',
|
||||
gitee:'码云'
|
||||
}
|
||||
}
|
||||
// 路由国际化
|
||||
route: {
|
||||
dashboard: '首页',
|
||||
document: '项目文档'
|
||||
},
|
||||
// 登录页面国际化
|
||||
login: {
|
||||
title: 'vue3-element-admin',
|
||||
username: '用户名',
|
||||
password: '密码',
|
||||
login: '登 录',
|
||||
code: '请输入验证码',
|
||||
copyright: '',
|
||||
icp: ''
|
||||
},
|
||||
navbar: {
|
||||
dashboard: '首页',
|
||||
logout: '注销',
|
||||
document: '项目文档',
|
||||
gitee: '码云'
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user