diff --git a/src/i18n/build.js b/src/i18n/build.js
index c94ccaa95476c0166fb1722f553edc31930ed2e1..5a133ab7e94d7131653563a0553c284c726c9e59 100644
--- a/src/i18n/build.js
+++ b/src/i18n/build.js
@@ -10,7 +10,10 @@ const LOCAL_LISTS = [
{code: 'zh_CN', name: "简体中文"}
]
+// 默认地区
const DEFAULT_LOCALE = 'zh_CN'
+// 为空展示地区
+const DEFAULT_SHOW_LOCALE = 'en'
const codeToLocale = (code) => {
return code === "_default" ? DEFAULT_LOCALE : code;
@@ -59,6 +62,7 @@ const getAllLocale = () => {
let locales = {
lists: LOCAL_LISTS,
default_locale: DEFAULT_LOCALE,
+ default_show_locale: DEFAULT_SHOW_LOCALE,
detail: {}
}
fs.readdirSync(path.resolve(path.join(__dirname, "locales"))).forEach((code) => {
@@ -107,9 +111,9 @@ module.exports = {
let text = key;
if ((locale in locales) && (key in locales[locale])) {
text = locales[locale][key]['message']
- } else if (locale !== DEFAULT_LOCALE) {
+ } else if (locale !== DEFAULT_SHOW_LOCALE) {
// 获取默认语言
- text = this.getMessage(DEFAULT_LOCALE, key)
+ text = this.getMessage(DEFAULT_SHOW_LOCALE, key)
}
return text;
},
diff --git a/src/i18n/index.js b/src/i18n/index.js
index 47ab367622876721a7ab7e6a2cc04cc3bfad5c29..b5b0d768c48ecd40083d7c4d0c1db088e9a802c7 100644
--- a/src/i18n/index.js
+++ b/src/i18n/index.js
@@ -11,6 +11,7 @@ const locales = require('./locales/build.json')
export const LOCALE_LISTS = locales.lists
export const LOCALE_DETAIL = locales.detail
export const DEFAULT_LOCALE = locales.default_locale
+export const DEFAULT_SHOW_LOCALE = locales.default_show_locale
let currentLocale = "";
@@ -24,10 +25,9 @@ const getMessage = (code, key) => {
let text = key;
if ((locale in LOCALE_DETAIL) && (key in LOCALE_DETAIL[locale])) {
text = LOCALE_DETAIL[locale][key]['message']
- }
- else if(locale !== DEFAULT_LOCALE){
+ } else if (locale !== DEFAULT_SHOW_LOCALE) {
// 获取默认语言
- text = getMessage(DEFAULT_LOCALE,key)
+ text = getMessage(DEFAULT_SHOW_LOCALE, key)
}
return text;
}
@@ -48,7 +48,7 @@ const translate = (code, key, values = {}) => {
return chromiumGetMessage(key, values, placeholders)
}
- let text = getMessage(code,key);
+ let text = getMessage(code, key);
const matchRge = new RegExp('{.+?}', 'g')
const matchString = text.match(matchRge);
diff --git a/src/i18n/locales/en/mian.i18n.json5 b/src/i18n/locales/en/main.i18n.json5
similarity index 100%
rename from src/i18n/locales/en/mian.i18n.json5
rename to src/i18n/locales/en/main.i18n.json5
diff --git a/src/tool.vue b/src/tool.vue
index 3ad84c5cf8bed0d04724e4c789f1496a1e8eeba2..36bcb0fcab1f02b57e52e48afbc19f9599ab5414 100644
--- a/src/tool.vue
+++ b/src/tool.vue
@@ -2,12 +2,12 @@