Docs: add English language support (#170)
* feat: support lang entry build * feat: vant support lang switch * move lang iframe-router to utils & fix router link bug * add en-US config && add some translation * chang async. to async_ (support superman cdn) * add layout translation * change nav style * upgrade zan-doc * fix: doc config * upgrade zan-doc && remove useless code * fix changelog generate path
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
const userLang = window.localStorage.getItem('VANT_LANGUAGE') || window.navigator.language || 'en-US';
|
||||
let defaultLang = 'en-US';
|
||||
if (userLang.indexOf('zh-') !== -1) {
|
||||
defaultLang = 'zh-CN';
|
||||
}
|
||||
|
||||
let currentLang = defaultLang;
|
||||
|
||||
export function getLang() {
|
||||
return currentLang;
|
||||
}
|
||||
|
||||
export function setLang(lang) {
|
||||
window.localStorage.setItem('VANT_LANGUAGE', lang);
|
||||
currentLang = lang;
|
||||
}
|
||||
Reference in New Issue
Block a user