Skip to content

Commit 0c88f23

Browse files
authored
fix: add supportLanguages and fixed some bug (#20)
* fix:update i18n * fix: fixed application and i18n * fix: add supportLanguages and fixed some bug
1 parent 252b7db commit 0c88f23

File tree

5 files changed

+182
-124
lines changed

5 files changed

+182
-124
lines changed

packages/web/src/App.vue

+20
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
import { defineComponent } from 'vue';
77
import { useRouter } from 'vue-router';
88
import { useDevelopingApps } from './stores/app';
9+
import { supportLanguages } from './i18n';
10+
import { i18n } from './boot/i18n';
911
1012
export default defineComponent({
1113
name: 'App',
@@ -28,6 +30,24 @@ export default defineComponent({
2830
const host = window.location.origin;
2931
appStore.setUrl(host);
3032
33+
let terminusLanguage = '';
34+
let terminusLanguageInfo = document.querySelector(
35+
'meta[name="terminus-language"]'
36+
);
37+
if (terminusLanguageInfo && terminusLanguageInfo.content) {
38+
terminusLanguage = terminusLanguageInfo.content;
39+
} else {
40+
terminusLanguage = navigator.language;
41+
}
42+
43+
console.log(navigator.language);
44+
45+
if (terminusLanguage) {
46+
if (supportLanguages.find((e) => e.value == terminusLanguage)) {
47+
i18n.global.locale.value = terminusLanguage;
48+
}
49+
}
50+
3151
return {};
3252
}
3353
});

packages/web/src/components/EditComponent.vue

+2-3
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,6 @@ const chartNodes = ref<any>([]);
122122
const selectedKey = ref(null);
123123
const tempFile = ref();
124124
const fileStatus = ref(false);
125-
const currentFile = ref();
126125
127126
const fileInfo = reactive({
128127
code: '',
@@ -302,7 +301,7 @@ const checkFileSave = (value) => {
302301
background: '#00BE9E',
303302
color: '#ffffff'
304303
},
305-
title: 'Reanme',
304+
title: t('message.confirmation'),
306305
message: t('message.save_file')
307306
})
308307
.then(async (val) => {
@@ -444,7 +443,7 @@ const renameDialg = (path: string, label: string, action: OPERATE_ACTION) => {
444443
background: '#00BE9E',
445444
color: '#ffffff'
446445
},
447-
title: 'Reanme',
446+
title: t('message.rename_file'),
448447
prompt: {
449448
model: label,
450449
isValid: (val) => val.length > 2,

packages/web/src/i18n/en-US/index.ts

+11-1
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,16 @@ export default {
303303
delete_file_success: 'File deleted successfully',
304304
delete_file_failed: 'Failed to delete',
305305
deleteTip: 'Delete this file/folder?',
306-
save_file: 'Do you want to save the current file?'
306+
save_file: 'Do you want to save the current file?',
307+
rename_file: 'Rename File',
308+
confirmation: 'Confirmation',
309+
start_installing: 'Start installing',
310+
start_upgrade: 'Start upgraging',
311+
start_uninstalling: 'Start uninstalling',
312+
cancel_installation: 'Are you sure you want to cancel the installation?',
313+
successfully: 'Successfully',
314+
upgrade_app: 'Are you sure you want to Upgrade the app?',
315+
uninstall_app: 'Are you sure you want to uninstall the app?',
316+
delete_app: 'Are you sure to delete the app?'
307317
}
308318
};

packages/web/src/i18n/zh-CN/index.ts

+11-1
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,16 @@ export default {
277277
delete_file_success: '删除成功',
278278
delete_file_failed: '删除失败',
279279
deleteTip: '确定删除这个文件/文件夹吗?',
280-
save_file: '是否保存当前文件?'
280+
save_file: '是否保存当前文件?',
281+
rename_file: '重命名',
282+
confirmation: '确定',
283+
start_installing: '开始安装',
284+
start_upgrade: '开始更新',
285+
start_uninstalling: '开始卸载',
286+
cancel_installation: '确定取消安装吗?',
287+
successfully: '成功',
288+
upgrade_app: '确定更新App吗?',
289+
uninstall_app: '确定卸载App吗?',
290+
delete_app: '确定删除App吗?'
281291
}
282292
};

0 commit comments

Comments
 (0)