Skip to content

Commit a8822e7

Browse files
authored
feat: add i18n items for UI (#338)
Co-authored-by: rick <[email protected]>
1 parent c585439 commit a8822e7

File tree

7 files changed

+53
-22
lines changed

7 files changed

+53
-22
lines changed

console/atest-ui/src/App.vue

+7-4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ import TestingPanel from './views/TestingPanel.vue'
1212
import StoreManager from './views/StoreManager.vue'
1313
import SecretManager from './views/SecretManager.vue'
1414
import WelcomePage from './views/WelcomePage.vue'
15+
import { useI18n } from 'vue-i18n'
16+
17+
const { t } = useI18n()
1518
1619
import setAsDarkTheme from './theme'
1720
@@ -70,19 +73,19 @@ const handleSelect = (key: string) => {
7073
>
7174
<el-menu-item index="welcome">
7275
<el-icon><share /></el-icon>
73-
<template #title>Welcome</template>
76+
<template #title>{{ t('title.welcome') }}</template>
7477
</el-menu-item>
7578
<el-menu-item index="testing" test-id="testing-menu">
7679
<el-icon><icon-menu /></el-icon>
77-
<template #title>Testing</template>
80+
<template #title>{{ t('title.testing' )}}</template>
7881
</el-menu-item>
7982
<el-menu-item index="secret">
8083
<el-icon><document /></el-icon>
81-
<template #title>Secrets</template>
84+
<template #title>{{ t('title.secrets') }}</template>
8285
</el-menu-item>
8386
<el-menu-item index="store">
8487
<el-icon><location /></el-icon>
85-
<template #title>Stores</template>
88+
<template #title>{{ t('title.stores') }}</template>
8689
</el-menu-item>
8790
</el-menu>
8891
</el-aside>

console/atest-ui/src/locales/en.json

+15-4
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,20 @@
2525
"protoContent": "Proto Content",
2626
"protoFile": "Proto File",
2727
"protoImport": "Proto Import",
28-
"param": "Parameter",
29-
"refelction": "Refelction"
28+
"parameter": "Parameter",
29+
"refelction": "Refelction",
30+
"apiRequestParameter": "API Request Parameter",
31+
"codeGenerator": "Code Generator",
32+
"testing": "Testing",
33+
"welcome": "Welcome",
34+
"secrets": "Secrets",
35+
"stores": "Stores",
36+
"templateQuery": "Template Functions Query",
37+
"output": "Output"
3038
},
3139
"tip": {
32-
"filter": "Filter Keyword"
40+
"filter": "Filter Keyword",
41+
"noParameter": "No Parameter"
3342
},
3443
"field": {
3544
"name": "Name",
@@ -43,7 +52,9 @@
4352
"status": "Status",
4453
"operations": "Operations",
4554
"storageLocation": "Storage Location",
46-
"suiteKind": "Suite Kind"
55+
"suiteKind": "Suite Kind",
56+
"key": "Key",
57+
"value": "Value"
4758
},
4859
"//see http spec": "https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403",
4960
"httpCode": {

console/atest-ui/src/locales/zh.json

+20-4
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,33 @@
88
"save": "保存",
99
"delete": "删除",
1010
"send": "发送",
11+
"copy": "拷贝",
1112
"toolbox": "工具箱",
1213
"refresh": "刷新",
1314
"newtestcase": "新建测试用例",
14-
"verify": "检查"
15+
"verify": "检查",
16+
"generateCode": "生成代码",
17+
"sendWithParam": "参数化"
1518
},
1619
"title": {
1720
"createTestSuite": "创建测试用例集",
1821
"createTestCase": "创建测试用例",
1922
"createStore": "创建存储",
2023
"createSecret": "创建凭据",
21-
"secretManager": "凭据管理"
24+
"secretManager": "凭据管理",
25+
"apiRequestParameter": "API 请求参数",
26+
"codeGenerator": "代码生成",
27+
"testing": "测试",
28+
"welcome": "欢迎",
29+
"secrets": "凭据",
30+
"stores": "存储",
31+
"parameter": "参数",
32+
"templateQuery": "模板函数查询",
33+
"output": "输出"
2234
},
2335
"tip": {
24-
"filter": "过滤"
36+
"filter": "过滤",
37+
"noParameter": "无参数"
2538
},
2639
"field": {
2740
"name": "名称",
@@ -33,6 +46,9 @@
3346
"pluginURL": "插件地址",
3447
"status": "状态",
3548
"operations": "操作",
36-
"storageLocation": "保存位置"
49+
"storageLocation": "保存位置",
50+
"suiteKind": "类型",
51+
"key": "",
52+
"value": ""
3753
}
3854
}

console/atest-ui/src/views/TemplateFunctions.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function queryFuncs() {
2323
data-intro="You can search your desired template functions.">{{ t('button.toolbox') }}</el-button>
2424
</el-affix>
2525

26-
<el-dialog v-model="dialogVisible" title="Template Functions Query" width="40%" draggable destroy-on-close>
26+
<el-dialog v-model="dialogVisible" :title="t('title.templateQuery')" width="40%" draggable destroy-on-close>
2727
<template #footer>
2828
<el-input v-model="query" placeholder="Query after enter" v-on:keyup.enter="queryFuncs" />
2929
<span class="dialog-footer">
@@ -44,4 +44,4 @@ function queryFuncs() {
4444
</span>
4545
</template>
4646
</el-dialog>
47-
</template>
47+
</template>

console/atest-ui/src/views/TestCase.vue

+7-6
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,7 @@ const queryHeaderValues = (queryString: string, cb: (arg: any) => void) => {
692692

693693
<el-drawer v-model="codeDialogOpened" size="50%">
694694
<template #header>
695-
<h4>Code Generator</h4>
695+
<h4>{{ t('title.codeGenerator') }}</h4>
696696
</template>
697697
<template #default>
698698
<div style="padding-bottom: 10px;">
@@ -718,16 +718,17 @@ const queryHeaderValues = (queryString: string, cb: (arg: any) => void) => {
718718

719719
<el-drawer v-model="parameterDialogOpened">
720720
<template #header>
721-
<h4>API Request Parameters</h4>
721+
<h4>{{ t('title.apiRequestParameter') }}</h4>
722722
</template>
723723
<template #default>
724-
<el-table :data="parameters" style="width: 100%">
725-
<el-table-column label="Key" width="180">
724+
<el-table :data="parameters" style="width: 100%"
725+
:empty-text="t('tip.noParameter')">
726+
<el-table-column :label="t('field.key')" width="180">
726727
<template #default="scope">
727728
<el-input v-model="scope.row.key" placeholder="Key" @change="paramChange"/>
728729
</template>
729730
</el-table-column>
730-
<el-table-column label="Value">
731+
<el-table-column :label="t('field.value')">
731732
<template #default="scope">
732733
<div style="display: flex; align-items: center">
733734
<el-input v-model="scope.row.value" placeholder="Value" />
@@ -743,7 +744,7 @@ const queryHeaderValues = (queryString: string, cb: (arg: any) => void) => {
743744

744745
<el-footer style="height: auto;">
745746
<el-tabs v-model="testResultActiveTab">
746-
<el-tab-pane label="Output" name="output">
747+
<el-tab-pane :label="t('title.output')" name="output">
747748
<el-tag class="ml-2" type="success" v-if="testResult.statusCode && testResult.error === ''">{{ t('httpCode.' + testResult.statusCode) }}</el-tag>
748749
<el-tag class="ml-2" type="danger" v-if="testResult.statusCode && testResult.error !== ''">{{ t('httpCode.' + testResult.statusCode) }}</el-tag>
749750

console/atest-ui/src/views/TestSuite.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ function paramChange() {
210210
<el-input class="mx-1" v-model="suite.spec.url" placeholder="API Spec URL"></el-input>
211211

212212
<div>
213-
<span>{{ t('title.param') }}</span>
213+
<span>{{ t('title.parameter') }}</span>
214214
<el-table :data="suite.param" style="width: 100%">
215215
<el-table-column label="Key" width="180">
216216
<template #default="scope">

console/atest-ui/src/views/TestingPanel.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ const suiteKinds = [{
312312
data-intro="Click here to import from Postman"
313313
test-id="open-import-suite-dialog">{{ t('button.import') }}</el-button>
314314
<el-button type="primary" @click="loadStores" :icon="Refresh">{{ t('button.refresh') }}</el-button>
315-
<el-input v-model="filterText" placeholder="Filter keyword" test-id="search" style="padding: 5px;" />
315+
<el-input v-model="filterText" :placeholder="t('tip.filter')" test-id="search" style="padding: 5px;" />
316316

317317
<el-tree
318318
v-loading="storesLoading"

0 commit comments

Comments
 (0)