Skip to content

Commit

Permalink
fix: refine user default language zh-CN
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas-Liang committed Nov 11, 2020
1 parent d5145cb commit 4fa3602
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions examples/route.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,19 +157,20 @@ route.push({
name: 'play',
component: require('./play/index.vue')
})

const userLanguage =
localStorage.getItem('ELEMENT_LANGUAGE') ||
window.navigator.language ||
'zh-CN'
//To-do:目前只支持中文环境,所以设置中文为默认值
let defaultPath = '/zh-CN'
if (userLanguage.indexOf('zh-') !== -1) {
defaultPath = '/zh-CN'
} else if (userLanguage.indexOf('es') !== -1) {
defaultPath = '/es'
} else if (userLanguage.indexOf('fr') !== -1) {
defaultPath = '/fr-FR'
}
// const userLanguage =
// localStorage.getItem('ELEMENT_LANGUAGE') ||
// window.navigator.language ||
// 'zh-CN'
// let defaultPath = '/zh-CN'
// if (userLanguage.indexOf('zh-') !== -1) {
// defaultPath = '/zh-CN'
// } else if (userLanguage.indexOf('es') !== -1) {
// defaultPath = '/es'
// } else if (userLanguage.indexOf('fr') !== -1) {
// defaultPath = '/fr-FR'
// }

route = route.concat([
{
Expand Down

0 comments on commit 4fa3602

Please sign in to comment.