修复element ui国际化文件加载失败的bug

This commit is contained in:
q4speed 2020-05-11 11:48:52 +08:00
parent 6de53a5997
commit f07078fdf6
4 changed files with 12 additions and 9 deletions

View File

@ -85,7 +85,7 @@
handleCommand(command) { handleCommand(command) {
switch (command) { switch (command) {
case "personal": case "personal":
this.$setLang("en-US"); this.$setLang("en_US");
break; break;
case "logout": case "logout":
this.$get("/signout", function () { this.$get("/signout", function () {

View File

@ -193,24 +193,24 @@ export default {
running: "Running", running: "Running",
reset: "Rest", reset: "Rest",
input_name: "Please enter the test name", input_name: "Please enter the test name",
select_project: "Please select project", select_project: "Select project",
scenario: { scenario: {
config: "Scenario Config", config: "Scenario Config",
input_name: "Please enter the scenario name", input_name: "Please enter the scenario name",
name: "Scenario Name", name: "Scenario Name",
base_url: "Base URL", base_url: "Base URL",
base_url_description: "Base URL as URL prefix for all requests", base_url_description: "Base URL as URL prefix for all requests",
parameters: "arguments", parameters: "Parameters",
headers: "Headers", headers: "Headers",
kv_description: "Will be used for requests where the item is not set", kv_description: "Will be used for requests where the item is not set",
}, },
request: { request: {
input_name: "Please enter the request name", input_name: "Please enter the request name",
name: "Request Name", name: "Name",
method: "Method", method: "Method",
url: "url", url: "URL",
url_description: "etc: https://fit2cloud.com", url_description: "etc: https://fit2cloud.com",
parameters: "arguments", parameters: "Parameters",
parameters_desc: "Parameters will be appended to the URL e.g. https://fit2cloud.com?Name=Value&Name2=Value2", parameters_desc: "Parameters will be appended to the URL e.g. https://fit2cloud.com?Name=Value&Name2=Value2",
headers: "Headers", headers: "Headers",
body: "Body", body: "Body",
@ -234,6 +234,7 @@ export default {
response_in_time: "Response in time", response_in_time: "Response in time",
}, },
extract: "Extract from response", extract: "Extract from response",
extract_desc: "Extract data from the response and store it in variables. Use the variables in subsequent requests.",
} }
}, },
api_report: { api_report: {

View File

@ -13,8 +13,8 @@ const messages = {
...enLocale ...enLocale
}, },
'zh_CN': { 'zh_CN': {
...zh_CN, ...zh_CNLocale,
...zh_CNLocale ...zh_CN
}, },
'zh_TW': { 'zh_TW': {
...zh_TWLocale ...zh_TWLocale
@ -38,7 +38,8 @@ function setI18nLanguage(lang) {
Vue.prototype.$setLang = function (lang) { Vue.prototype.$setLang = function (lang) {
if (i18n.locale !== lang) { if (i18n.locale !== lang) {
if (!loadedLanguages.includes(lang)) { if (!loadedLanguages.includes(lang)) {
return import(`./${lang}`).then(response => { let file = lang.replace("_", "-");
return import(`./${file}`).then(response => {
i18n.mergeLocaleMessage(lang, response.default); i18n.mergeLocaleMessage(lang, response.default);
loadedLanguages.push(lang); loadedLanguages.push(lang);
return setI18nLanguage(lang) return setI18nLanguage(lang)

View File

@ -237,6 +237,7 @@ export default {
response_in_time: "响应时间在...毫秒以内", response_in_time: "响应时间在...毫秒以内",
}, },
extract: "提取", extract: "提取",
extract_desc: "从响应中提取数据并将其存储在变量中。在后续请求中使用变量",
} }
}, },
api_report: { api_report: {