提交 2b7c1ad1 编写于 作者: D DCloud_LXH

chore: config

上级 058600fb
...@@ -172,9 +172,9 @@ export const navbarLanguage = { ...@@ -172,9 +172,9 @@ export const navbarLanguage = {
{ {
text: 'English', text: 'English',
link: 'https://en.uniapp.dcloud.io/', link: 'https://en.uniapp.dcloud.io/',
click() { /* click() {
localStorage.setItem(window.__UNI_DOCS_ZH_KEY__ || 'unidocs-zh-language', 'en') localStorage.setItem(window.__UNI_DOCS_ZH_KEY__ || 'unidocs-zh-language', 'en')
} } */
} }
] ]
} }
\ No newline at end of file
...@@ -6,32 +6,12 @@ var website_EN_host = 'en.uniapp.dcloud.io' ...@@ -6,32 +6,12 @@ var website_EN_host = 'en.uniapp.dcloud.io'
var website_ZH = 'https://' + website_ZH_host; var website_ZH = 'https://' + website_ZH_host;
var website_EN = 'https://' + website_EN_host; var website_EN = 'https://' + website_EN_host;
window.__UNI_DOCS_ZH_KEY__ = 'unidocs-zh-language' // window.__UNI_DOCS_ZH_KEY__ = 'unidocs-zh-language'
if (host === 'uniapp.dcloud.io') { if (host === 'uniapp.dcloud.io') {
var localStorageLanguage = localStorage.getItem(window.__UNI_DOCS_ZH_KEY__) var website_finally =
navigator.language.indexOf('zh') !== -1
if (localStorageLanguage) { ? website_ZH
switch (localStorageLanguage) { : website_EN;
case LOCAL_ZH: window.location.href = website_finally + pathname;
if (host !== website_ZH_host) {
window.location.href = website_ZH + pathname;
}
break;
case LOCAL_EN:
if (host !== website_EN_host) {
window.location.href = website_EN + pathname;
}
break;
default:
break;
}
} else {
var website_finally =
navigator.language.indexOf('zh') !== -1
? website_ZH
: website_EN;
window.location.href = website_finally + pathname;
}
} }
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册