工作空间国际化 0.2

This commit is contained in:
Captain.B 2020-02-26 11:24:52 +08:00
parent 194f8fa372
commit 3923aca94f
3 changed files with 34 additions and 12 deletions

View File

@ -3,10 +3,20 @@ const en_US = {
'workspace': 'Workspace', 'workspace': 'Workspace',
'name': 'Name', 'name': 'Name',
'description': 'Description', 'description': 'Description',
'save': 'Save' 'save': 'Save',
'save_success': 'Saved successfully',
'delete_success': 'Deleted successfully',
'confirm': 'Confirm',
'cancel': 'Cancel',
'prompt': 'Prompt',
}, },
workspace: { workspace: {
'create': 'Create Workspace', 'create': 'Create Workspace',
'delete_confirm': 'Are you sure you want to delete this workspace?',
'add': 'Add Workspace',
'input_name': 'Please enter a workspace name',
'input_name_2_50': '2 to 50 characters in length',
'search_by_name': 'Search by name',
}, },
i18n: { i18n: {
'home': 'Home', 'home': 'Home',

View File

@ -3,10 +3,20 @@ const zh_CN = {
'workspace': '工作空间', 'workspace': '工作空间',
'name': '名称', 'name': '名称',
'description': '描述', 'description': '描述',
'save': '保存' 'save': '保存',
'save_success': '保存成功',
'delete_success': '删除成功',
'confirm': '确定',
'cancel': '取消',
'prompt': '提示',
}, },
workspace: { workspace: {
'create': '创建工作空间', 'create': '创建工作空间',
'delete_confirm': '这个工作空间确定要删除吗?',
'add': '添加工作空间',
'input_name': '请输入工作空间名称',
'input_name_2_50': '长度在 2 到 50 个字符',
'search_by_name': '根据名称搜索',
}, },
i18n: { i18n: {
'home': '首页', 'home': '首页',

View File

@ -8,7 +8,8 @@
<ms-create-box :tips="btnTips" :exec="create"/> <ms-create-box :tips="btnTips" :exec="create"/>
</span> </span>
<span class="search"> <span class="search">
<el-input type="text" size="small" placeholder="根据名称搜索" prefix-icon="el-icon-search" <el-input type="text" size="small" :placeholder="$t('workspace.search_by_name')"
prefix-icon="el-icon-search"
maxlength="60" v-model="condition" clearable/> maxlength="60" v-model="condition" clearable/>
</span> </span>
</el-row> </el-row>
@ -83,7 +84,7 @@
this.$post("/workspace/" + saveType, this.form, () => { this.$post("/workspace/" + saveType, this.form, () => {
this.createVisible = false; this.createVisible = false;
this.list(); this.list();
Message.success('保存成功'); Message.success(this.$t('commons.save_success'));
}); });
} else { } else {
return false; return false;
@ -92,7 +93,8 @@
}, },
edit(row) { edit(row) {
this.createVisible = true; this.createVisible = true;
this.form = row; // copy user
this.form = Object.assign({}, row);
// let self = this; // let self = this;
// let getUser1 = this.$get("/test/user"); // let getUser1 = this.$get("/test/user");
@ -103,13 +105,13 @@
// }); // });
}, },
del(row) { del(row) {
this.$confirm('这个工作空间确定要删除吗?', '提示', { this.$confirm(this.$t('workspace.delete_confirm'), this.$t('commons.prompt'), {
confirmButtonText: '确定', confirmButtonText: this.$t('commons.confirm'),
cancelButtonText: '取消', cancelButtonText: this.$t('commons.cancel'),
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.$get('/workspace/delete/' + row.id, () => { this.$get('/workspace/delete/' + row.id, () => {
Message.success('删除成功'); Message.success(this.$t('commons.delete_success'));
this.list(); this.list();
}); });
}).catch(() => { }).catch(() => {
@ -138,7 +140,7 @@
result: {}, result: {},
loading: false, loading: false,
createVisible: false, createVisible: false,
btnTips: "添加工作空间", btnTips: this.$t('workspace.add'),
condition: "", condition: "",
items: [], items: [],
currentPage: 1, currentPage: 1,
@ -150,8 +152,8 @@
}, },
rules: { rules: {
name: [ name: [
{required: true, message: '请输入工作空间名称', trigger: 'blur'}, {required: true, message: this.$t('workspace.input_name'), trigger: 'blur'},
{min: 2, max: 50, message: '长度在 2 到 50 个字符', trigger: 'blur'} {min: 2, max: 50, message: this.$t('workspace.input_name_2_50'), trigger: 'blur'}
] ]
}, },
} }