icon i18n

This commit is contained in:
Jesse-Ma
2022-12-02 17:58:20 +08:00
parent 49916b166e
commit 7fb00c8cf5
13 changed files with 24 additions and 144 deletions

View File

@@ -4,6 +4,7 @@ const en = {
},
content: {
blankTip: "I am Blank.",
noteTip: "Start writing something...",
},
button: {
ok: "OK",

View File

@@ -3,7 +3,8 @@ const zh = {
askTodelete: "是否确定要删除?",
},
content: {
blankTip: "I am Blank.",
blankTip: "空白的内容。",
noteTip: "开始写下一些东西吧。。。"
},
button: {
ok: "好的",

View File

@@ -5,20 +5,26 @@ Vue.use(VueI18n);
import zh from "./config/zh";
import en from "./config/en";
const messages = {
zh,
en,
}
const i18n = new VueI18n({
messages: messages,
locale: getLocale(),
messages: {
zh,
en,
},
});
function getLocale(){
if(localStorage.getItem("locale")){
return localStorage.getItem("locale").substring(0,2);
}
function getLocale() {
var lang = navigator.language;
if (lang) {
lang = lang.substring(0, 2);
}
return "en";
if (Object.keys(messages).indexOf(lang) >= 0) {
return lang;
}
return "en";
}
export default i18n;