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 @@
- + - {{ $t('mian_category_'+cat.name) }} + {{ $t('main_category_'+cat.name) }} @@ -34,31 +34,31 @@ - {{ $t('mian_tool_'+tool.name) }} + {{ $t('main_tool_'+tool.name) }}
- +
- + @@ -91,17 +91,17 @@ export default { historyShow: false, historyColumns: [ { - title: this.$t('mian_history_time'), + title: this.$t('main_history_time'), key: 'time', width: 180 }, { - title: this.$t('mian_history_data'), + title: this.$t('main_history_data'), slot: '_value', ellipsis: true, }, { - title: this.$t('mian_history_op'), + title: this.$t('main_history_op'), slot: '_op', width: 150 } @@ -204,7 +204,7 @@ export default { history() { let history = historyFactory(this.currentTool) if (history.length() < 1) { - return this.$Message.error(this.$t('mian_history_null')) + return this.$Message.error(this.$t('main_history_null')) } this.historyData = history.all() this.historyShow = true @@ -224,7 +224,7 @@ export default { }) }, width: 700, - okText: this.$t('mian_ui_close') + okText: this.$t('main_ui_close') }) }, historyClear() { diff --git a/src/tool/adapter.js b/src/tool/adapter.js index 43d71b373d5b346eea036053c4acb6462559184f..c518415b0dbdec67a2042af90c125a8d8a74020a 100644 --- a/src/tool/adapter.js +++ b/src/tool/adapter.js @@ -153,7 +153,7 @@ const utoolsConfigWrite = { for (let tool of tools) { // 初始化数据 let code = "ctool-" + tool.name; - let toolTitle = i18nBuild.translate(`mian_tool_${tool.name}`) + let toolTitle = i18nBuild.translate(`main_tool_${tool.name}`) let toolFeatures = featureConfig.hasOwnProperty(tool.name) ? featureConfig[tool.name] : [] if (!utoolsToolFeature.hasOwnProperty(code)) { utoolsToolFeature[code] = { diff --git a/src/views/setting/block.vue b/src/views/setting/block.vue index b0e1be21fb30e0f729f920e3db78d11ff36f046a..354952a4637edcab727ade94a83f8914616b2a5d 100644 --- a/src/views/setting/block.vue +++ b/src/views/setting/block.vue @@ -2,32 +2,32 @@
- - - + + + - + - + - + - +
- +
@@ -86,16 +86,16 @@ export default { case 'shortcuts': if (this.is_firefox) { return this.$Notice.success({ - title: this.$t('mian_keyboard_firefox_1'), + title: this.$t('main_keyboard_firefox_1'), render: h => { return h('span', [ - this.$t('mian_keyboard_firefox_2'), + this.$t('main_keyboard_firefox_2'), h('a', { attrs: { href: 'https://jingyan.baidu.com/article/3ea51489f1d0a713e61bbaff.html', target: '_blank' } - }, this.$t('mian_keyboard_firefox_3')), + }, this.$t('main_keyboard_firefox_3')), ]) } }); diff --git a/src/views/setting/common.vue b/src/views/setting/common.vue index e6c6805e3c913ab58bb682e692f3c338c41f0084..cde541427f23db5c2e95b094ab7cf2d7edc3ba9b 100644 --- a/src/views/setting/common.vue +++ b/src/views/setting/common.vue @@ -1,7 +1,7 @@ diff --git a/src/views/setting/setting.vue b/src/views/setting/setting.vue index a73dd162668063d424588a89d9c6999442117689..0519025fc98395c6ce9401c864136cc23d560598 100644 --- a/src/views/setting/setting.vue +++ b/src/views/setting/setting.vue @@ -1,7 +1,7 @@