工作空间国际化 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',
'name': 'Name',
'description': 'Description',
'save': 'Save'
'save': 'Save',
'save_success': 'Saved successfully',
'delete_success': 'Deleted successfully',
'confirm': 'Confirm',
'cancel': 'Cancel',
'prompt': 'Prompt',
},
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: {
'home': 'Home',

View File

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

View File

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