From d44e5d2518da7ccd9da151d5a9d8e3915dafef1f Mon Sep 17 00:00:00 2001 From: Marvin Zhang Date: Wed, 27 Mar 2019 12:35:22 +0800 Subject: [PATCH] updated Multi Language for a few pages --- frontend/src/components/Breadcrumb/index.vue | 4 +- .../src/components/InfoView/NodeInfoView.vue | 2 +- .../components/InfoView/SpiderInfoView.vue | 18 ++--- .../src/components/Overview/NodeOverview.vue | 4 +- frontend/src/i18n/zh.js | 71 +++++++++++++++---- frontend/src/views/deploy/DeployList.vue | 14 ++-- frontend/src/views/home/Home.vue | 4 +- .../src/views/layout/components/Navbar.vue | 2 +- .../layout/components/Sidebar/SidebarItem.vue | 6 +- frontend/src/views/node/NodeList.vue | 28 ++++---- frontend/src/views/result/ResultList.vue | 6 +- frontend/src/views/spider/SpiderList.vue | 28 ++++---- frontend/src/views/task/TaskList.vue | 6 +- 13 files changed, 118 insertions(+), 75 deletions(-) diff --git a/frontend/src/components/Breadcrumb/index.vue b/frontend/src/components/Breadcrumb/index.vue index 5b12d2d3..87a389b8 100644 --- a/frontend/src/components/Breadcrumb/index.vue +++ b/frontend/src/components/Breadcrumb/index.vue @@ -3,8 +3,8 @@ {{ item.meta.title }} - {{ item.meta.title }} + class="no-redirect">{{$t(item.meta.title) }} + {{ $t(item.meta.title) }} diff --git a/frontend/src/components/InfoView/NodeInfoView.vue b/frontend/src/components/InfoView/NodeInfoView.vue index b784aec0..69a3601a 100644 --- a/frontend/src/components/InfoView/NodeInfoView.vue +++ b/frontend/src/components/InfoView/NodeInfoView.vue @@ -51,7 +51,7 @@ export default { if (valid) { this.$store.dispatch('node/editNode') .then(() => { - this.$message.success('Node has been saved successfully') + this.$message.success(this.$t('Node info has been saved successfully')) }) } }) diff --git a/frontend/src/components/InfoView/SpiderInfoView.vue b/frontend/src/components/InfoView/SpiderInfoView.vue index 676890dd..852b9c1f 100644 --- a/frontend/src/components/InfoView/SpiderInfoView.vue +++ b/frontend/src/components/InfoView/SpiderInfoView.vue @@ -116,14 +116,14 @@ export default { const row = this.spiderForm this.$refs['spiderForm'].validate(res => { if (res) { - this.$confirm('Are you sure to run this spider?', 'Notice', { - confirmButtonText: 'Confirm', - cancelButtonText: 'Cancel' + this.$confirm(this.$t('Are you sure to run this spider?'), this.$t('Notification'), { + confirmButtonText: this.$t('Confirm'), + cancelButtonText: this.$t('Cancel') }) .then(() => { this.$store.dispatch('spider/crawlSpider', row._id) .then(() => { - this.$message.success(`Running spider "${row._id}" has been scheduled`) + this.$message.success(this.$t(`Spider task has been scheduled`)) }) }) } @@ -133,14 +133,14 @@ export default { const row = this.spiderForm this.$refs['spiderForm'].validate(res => { if (res) { - this.$confirm('Are you sure to deploy this spider?', 'Notice', { - confirmButtonText: 'Confirm', - cancelButtonText: 'Cancel' + this.$confirm(this.$t('Are you sure to deploy this spider?'), this.$t('Notification'), { + confirmButtonText: this.$t('Confirm'), + cancelButtonText: this.$t('Cancel') }) .then(() => { this.$store.dispatch('spider/deploySpider', row._id) .then(() => { - this.$message.success(`Spider "${row._id}" has been deployed`) + this.$message.success(this.$t(`Spider has been deployed`)) }) }) } @@ -151,7 +151,7 @@ export default { if (res) { this.$store.dispatch('spider/editSpider') .then(() => { - this.$message.success('Spider info has been saved successfully') + this.$message.success(this.$t('Spider info has been saved successfully')) }) .catch(error => { this.$message.error(error) diff --git a/frontend/src/components/Overview/NodeOverview.vue b/frontend/src/components/Overview/NodeOverview.vue index 7f9baf0b..e6412343 100644 --- a/frontend/src/components/Overview/NodeOverview.vue +++ b/frontend/src/components/Overview/NodeOverview.vue @@ -3,12 +3,12 @@ - + - + diff --git a/frontend/src/i18n/zh.js b/frontend/src/i18n/zh.js index 4a401437..b044e7ba 100644 --- a/frontend/src/i18n/zh.js +++ b/frontend/src/i18n/zh.js @@ -1,4 +1,15 @@ export default { + // 菜单 + 'Home': '主页', + 'Nodes': '节点', + 'Node Detail': '节点详情', + 'Spiders': '爬虫', + 'Spider Detail': '爬虫详情', + 'Task': '任务', + 'Tasks': '任务', + 'Task Detail': '任务详情', + 'Deploys': '部署', + // 标签 Overview: '概览', Files: '文件', @@ -33,6 +44,13 @@ export default { View: '查看', Edit: '编辑', Remove: '删除', + Confirm: '确认', + + // 主页 + 'Total Tasks': '总任务数', + 'Active Nodes': '在线节点', + 'Total Deploys': '总部署数', + 'Daily New Tasks': '每日新增任务数', // 节点 'Node Info': '节点信息', @@ -41,21 +59,14 @@ export default { 'Node Port': '节点端口', 'Description': '描述', - // 任务 - 'Task Info': '任务信息', - 'Task ID': '任务ID', - 'Status': '状态', - 'Log File Path': '日志文件路径', - 'Create Timestamp': '创建时间', - 'Finish Timestamp': '完成时间', - 'Duration (sec)': '用时(秒)', - 'Error Message': '错误信息', + // 节点列表 + 'IP': 'IP地址', + 'Port': '端口', - // 任务列表 - 'Node': '节点', - 'Create Time': '创建时间', - 'Start Time': '开始时间', - 'Finish Time': '结束时间', + // 节点状态 + Online: '在线', + Offline: '在线', + Unavailable: '未知', // 爬虫 'Spider Info': '爬虫信息', @@ -74,6 +85,25 @@ export default { 'Last Run': '上次运行', 'Action': '操作', + // 任务 + 'Task Info': '任务信息', + 'Task ID': '任务ID', + 'Status': '状态', + 'Log File Path': '日志文件路径', + 'Create Timestamp': '创建时间', + 'Finish Timestamp': '完成时间', + 'Duration (sec)': '用时(秒)', + 'Error Message': '错误信息', + + // 任务列表 + 'Node': '节点', + 'Create Time': '创建时间', + 'Start Time': '开始时间', + 'Finish Time': '结束时间', + + // 部署 + 'Time': '时间', + // 文件 'Choose Folder': '选择文件', @@ -84,4 +114,17 @@ export default { // 搜索 Search: '搜索', + + // 下拉框 + User: '用户', + Logout: '退出登录', + + // 弹出框 + Notification: '提示', + 'Are you sure to delete this node?': '你确定要删除该节点?', + 'Are you sure to run this spider?': '你确定要运行该爬虫?', + 'Node info has been saved successfully': '节点信息已成功保存', + 'Are you sure to deploy this spider?': '你确定要部署该爬虫?', + 'Are you sure to delete this spider?': '你确定要删除该爬虫?', + 'Spider info has been saved successfully': '爬虫信息已成功保存', } diff --git a/frontend/src/views/deploy/DeployList.vue b/frontend/src/views/deploy/DeployList.vue index 1b562fc9..5cc6d118 100644 --- a/frontend/src/views/deploy/DeployList.vue +++ b/frontend/src/views/deploy/DeployList.vue @@ -3,7 +3,7 @@
@@ -13,7 +13,7 @@ icon="el-icon-refresh" class="refresh" @click="onRefresh"> - Refresh + {{$t('Refresh')}}
@@ -26,7 +26,7 @@ - + diff --git a/frontend/src/views/home/Home.vue b/frontend/src/views/home/Home.vue index feda9904..e721a95c 100644 --- a/frontend/src/views/home/Home.vue +++ b/frontend/src/views/home/Home.vue @@ -9,7 +9,7 @@ - +
{{overviewStats[m.name]}}
@@ -21,7 +21,7 @@
-

Daily New Tasks

+

{{$t('Daily New Tasks')}}

diff --git a/frontend/src/views/layout/components/Navbar.vue b/frontend/src/views/layout/components/Navbar.vue index 6ed77a90..5b1f97f8 100644 --- a/frontend/src/views/layout/components/Navbar.vue +++ b/frontend/src/views/layout/components/Navbar.vue @@ -9,7 +9,7 @@ - LogOut + {{$t('Logout')}} diff --git a/frontend/src/views/layout/components/Sidebar/SidebarItem.vue b/frontend/src/views/layout/components/Sidebar/SidebarItem.vue index 420eb17f..9c525c24 100644 --- a/frontend/src/views/layout/components/Sidebar/SidebarItem.vue +++ b/frontend/src/views/layout/components/Sidebar/SidebarItem.vue @@ -6,14 +6,14 @@ + :title="$t(onlyOneChild.meta.title)"/> diff --git a/frontend/src/views/node/NodeList.vue b/frontend/src/views/node/NodeList.vue index 2370352b..d0cb11d4 100644 --- a/frontend/src/views/node/NodeList.vue +++ b/frontend/src/views/node/NodeList.vue @@ -3,7 +3,7 @@
@@ -13,7 +13,7 @@ icon="el-icon-refresh" class="refresh" @click="onRefresh"> - Refresh + {{$t('Refresh')}}
@@ -26,34 +26,34 @@ - + @@ -165,9 +165,9 @@ export default { this.dialogVisible = true }, onRemove (row) { - this.$confirm('Are you sure to delete this node?', 'Notification', { - confirmButtonText: 'Confirm', - cancelButtonText: 'Cancel', + this.$confirm(this.$t('Are you sure to delete this node?'), this.$t('Notification'), { + confirmButtonText: this.$t('Confirm'), + cancelButtonText: this.$t('Cancel'), type: 'warning' }).then(() => { this.$store.dispatch('node/deleteNode', row._id) diff --git a/frontend/src/views/result/ResultList.vue b/frontend/src/views/result/ResultList.vue index e724b9c7..85c70098 100644 --- a/frontend/src/views/result/ResultList.vue +++ b/frontend/src/views/result/ResultList.vue @@ -228,9 +228,9 @@ export default { this.dialogVisible = true }, onRemove (row) { - this.$confirm('Are you sure to delete this spider?', 'Notification', { - confirmButtonText: 'Confirm', - cancelButtonText: 'Cancel', + this.$confirm(this.$t('Are you sure to delete this spider?)', this.$t('Notification'), { + confirmButtonText: this.$t('Confirm'), + cancelButtonText: this.$t('Cancel'), type: 'warning' }).then(() => { this.$store.dispatch('spider/deleteSpider', row._id) diff --git a/frontend/src/views/spider/SpiderList.vue b/frontend/src/views/spider/SpiderList.vue index 700dfc6b..4ae640ea 100644 --- a/frontend/src/views/spider/SpiderList.vue +++ b/frontend/src/views/spider/SpiderList.vue @@ -219,9 +219,9 @@ export default { this.dialogVisible = true }, onRemove (row) { - this.$confirm('Are you sure to delete this spider?', 'Notification', { - confirmButtonText: 'Confirm', - cancelButtonText: 'Cancel', + this.$confirm(this.$t('Are you sure to delete this spider?'), this.$t('Notification'), { + confirmButtonText: this.$t('Confirm'), + cancelButtonText: this.$t('Cancel'), type: 'warning' }).then(() => { this.$store.dispatch('spider/deleteSpider', row._id) @@ -234,9 +234,9 @@ export default { }) }, onDeploy (row) { - this.$confirm('Are you sure to deploy this spider?', 'Notification', { - confirmButtonText: 'Confirm', - cancelButtonText: 'Cancel', + this.$confirm(this.$t('Are you sure to deploy this spider?'), this.$t('Notification'), { + confirmButtonText: this.$t('Confirm'), + cancelButtonText: this.$t('Cancel'), type: 'warning' }).then(() => { this.$store.dispatch('spider/deploySpider', row._id) @@ -249,14 +249,14 @@ export default { }) }, onCrawl (row) { - this.$confirm('Are you sure to run this spider', 'Notice', { - confirmButtonText: 'Confirm', - cancelButtonText: 'Cancel' + this.$confirm(this.$t('Are you sure to run this spider?'), this.$t('Notification'), { + confirmButtonText: this.$t('Confirm'), + cancelButtonText: this.$t('Cancel') }) .then(() => { this.$store.dispatch('spider/crawlSpider', row._id) .then(() => { - this.$message.success(`Running spider "${row._id}" has been scheduled`) + this.$message.success(this.$t(`Spider task has been scheduled`)) }) }) }, @@ -290,15 +290,15 @@ export default { this.dialogVisible = true }, onDeployAll () { - this.$confirm('Are you sure to deploy all spiders to active nodes?', 'Notice', { - confirmButtonText: 'Confirm', - cancelButtonText: 'Cancel', + this.$confirm(this.$t('Are you sure to deploy all spiders to active nodes?'), this.$t('Notification'), { + confirmButtonText: this.$t('Confirm'), + cancelButtonText: this.$t('Cancel'), type: 'warning' }) .then(() => { this.$store.dispatch('spider/deployAll') .then(() => { - this.$message.success('Deployed all spiders successfully') + this.$message.success(this.$t('Deployed all spiders successfully')) }) }) } diff --git a/frontend/src/views/task/TaskList.vue b/frontend/src/views/task/TaskList.vue index 49b93458..bf42dfce 100644 --- a/frontend/src/views/task/TaskList.vue +++ b/frontend/src/views/task/TaskList.vue @@ -166,9 +166,9 @@ export default { this.$store.dispatch('task/getTaskList') }, onRemove (row) { - this.$confirm('Are you sure to delete this task?', 'Notification', { - confirmButtonText: 'Confirm', - cancelButtonText: 'Cancel', + this.$confirm(this.$t('Are you sure to delete this task?'), this.$t('Notification'), { + confirmButtonText: this.$t('Confirm'), + cancelButtonText: this.$t('Cancel'), type: 'warning' }).then(() => { this.$store.dispatch('task/deleteTask', row._id)