Skip to content

A full-featured download manager.

feat: task i18n

Dr_rOot5a626cece957
diff --git a/src/renderer/components/Task/TaskItem.vue b/src/renderer/components/Task/TaskItem.vue
index 297803ea..da643135 100644
--- a/src/renderer/components/Task/TaskItem.vue
+++ b/src/renderer/components/Task/TaskItem.vue
@@ -17,7 +17,17 @@
<div v-if="task.status ==='active'">
<span>{{ task.downloadSpeed | bytesToSize }}/s</span>
<span>
- {{ remaining | timeFormat('剩余') }}
+ {{
+ remaining | timeFormat({
+ prefix: $t('task.remaining-prefix'),
+ i18n: {
+ 'gt1d': $t('app.gt1d'),
+ 'hour': $t('app.hour'),
+ 'minute': $t('app.minute'),
+ 'second': $t('app.second')
+ }
+ })
+ }}
</span>
</div>
</el-col>
@@ -55,7 +65,7 @@
},
computed: {
taskName: function () {
- return getTaskName(this.task, '获取任务名中...')
+ return getTaskName(this.task, this.$t('task.get-task-name'))
},
remaining: function () {
const { totalLength, completedLength, downloadSpeed } = this.task
diff --git a/src/renderer/components/Task/TaskItemInfo.vue b/src/renderer/components/Task/TaskItemInfo.vue
index 06696a6b..061e6762 100644
--- a/src/renderer/components/Task/TaskItemInfo.vue
+++ b/src/renderer/components/Task/TaskItemInfo.vue
@@ -26,7 +26,17 @@
<div v-if="task.status ==='active'">
<span>{{ task.downloadSpeed | bytesToSize }}/s</span>
<span>
- {{ remaining | timeFormat('剩余') }}
+ {{
+ remaining | timeFormat({
+ prefix: $t('task.remaining-prefix'),
+ i18n: {
+ 'gt1d': $t('app.gt1d'),
+ 'hour': $t('app.hour'),
+ 'minute': $t('app.minute'),
+ 'second': $t('app.second')
+ }
+ })
+ }}
</span>
</div>
</el-col>
@@ -69,12 +79,12 @@
},
computed: {
taskName: function () {
- return getTaskName(this.task, '获取任务名中...')
+ return getTaskName(this.task, this.$t('task.get-task-name'))
},
dialogTitle: function () {
const len = this.taskName.length
let title = len > 40 ? this.taskName.substr(0, 40) + '...' : this.taskName
- return `${title} 详情`
+ return this.$t('task.task-info-dialog-title', { title })
},
remaining: function () {
const { totalLength, completedLength, downloadSpeed } = this.task
diff --git a/src/renderer/store/modules/task.js b/src/renderer/store/modules/task.js
index 3de2cd5f..d31188dd 100644
--- a/src/renderer/store/modules/task.js
+++ b/src/renderer/store/modules/task.js
@@ -7,16 +7,7 @@ const state = {
taskList: []
}
-const listTitles = {
- 'active': '下载中',
- 'waiting': '已暂停',
- 'stopped': '已完成'
-}
-
const getters = {
- currentListTitle: (state, getters) => {
- return listTitles[state.currentList] ? listTitles[state.currentList] : ''
- }
}
const mutations = {
diff --git a/src/shared/locales/en/app.js b/src/shared/locales/en/app.js
index beba09ae..c76ab262 100644
--- a/src/shared/locales/en/app.js
+++ b/src/shared/locales/en/app.js
@@ -4,5 +4,9 @@ export default {
'about': 'About',
'preferences': 'Preferences',
'yes': 'Yes',
- 'no': 'No'
+ 'no': 'No',
+ 'gt1d': '> 1 day',
+ 'hour': 'H',
+ 'minute': 'm',
+ 'second': 's'
}
diff --git a/src/shared/locales/en/task.js b/src/shared/locales/en/task.js
index dfbe83d5..608b3b75 100644
--- a/src/shared/locales/en/task.js
+++ b/src/shared/locales/en/task.js
@@ -41,5 +41,13 @@ export default {
'get-task-name': 'Get the task name...',
'remaining-prefix': 'Remaining',
'select-torrent': 'Drag the torrent here, or click to select',
- 'task-info-dialog-title': '{title} Detail'
+ 'task-info-dialog-title': '{title} Detail',
+ 'download-start-message': 'Start download {taskName}',
+ 'download-pause-message': 'Pause download {taskName}',
+ 'download-stop-message': '{taskName} download stopped',
+ 'download-error-message': '{taskName} download error occurred',
+ 'download-complete-message': '{taskName} download completed',
+ 'download-complete-notify': 'Download Completed',
+ 'download-fail-message': '{taskName} download failed',
+ 'download-fail-notify': 'Download Failed'
}
diff --git a/src/shared/locales/zh/app.js b/src/shared/locales/zh/app.js
index 6d04ce10..a8cd5646 100644
--- a/src/shared/locales/zh/app.js
+++ b/src/shared/locales/zh/app.js
@@ -4,5 +4,9 @@ export default {
'about': '关于',
'preferences': '偏好设置',
'yes': '是',
- 'no': '否'
+ 'no': '否',
+ 'gt1d': '超过一天',
+ 'hour': '时',
+ 'minutes': '分',
+ 'seconds': '秒'
}
diff --git a/src/shared/locales/zh/task.js b/src/shared/locales/zh/task.js
index ca251de7..2d24f03d 100644
--- a/src/shared/locales/zh/task.js
+++ b/src/shared/locales/zh/task.js
@@ -41,5 +41,13 @@ export default {
'get-task-name': '获取任务名中...',
'remaining-prefix': '剩余',
'select-torrent': '将种子拖到此处,或点击选择',
- 'task-info-dialog-title': '{title} 详情'
+ 'task-info-dialog-title': '{title} 详情',
+ 'download-start-message': '开始下载 {taskName}',
+ 'download-pause-message': '暂停下载 {taskName}',
+ 'download-stop-message': '{taskName} 下载中止',
+ 'download-error-message': '{taskName} 下载发生错误',
+ 'task-complete-message': '{taskName} 下载完成',
+ 'task-complete-notify': '下载完成',
+ 'download-fail-message': '{taskName} 下载失败',
+ 'download-fail-notify': '下载失败'
}