From 244aac0f3ad81229b4597c8cc108f429ad39400d Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sat, 4 Jun 2016 14:05:37 +0800 Subject: [PATCH] refactor code --- app/langs/zh-CN.json | 7 ++++--- app/scripts/config/language-default.js | 5 +++-- app/scripts/filters/taskStatus.js | 18 +++++++++--------- app/views/list.html | 2 +- app/views/setting.html | 2 +- app/views/task-detail.html | 4 ++-- 6 files changed, 20 insertions(+), 18 deletions(-) diff --git a/app/langs/zh-CN.json b/app/langs/zh-CN.json index 9861c25..5e71f8f 100644 --- a/app/langs/zh-CN.json +++ b/app/langs/zh-CN.json @@ -50,7 +50,6 @@ "Remain Time": "剩余时间", "Download Speed": "下载速度", "Upload Speed": "上传速度", - "Files": "个文件", "Overview": "总览", "Blocks": "区块信息", "File List": "文件列表", @@ -83,7 +82,6 @@ "Loading": "正在加载...", "More Than One Day": "超过1天", "Unknown": "未知", - "Total Count": "共计", "Bytes": "字节", "Hours": "小时", "Minutes": "分", @@ -114,7 +112,10 @@ "time.minute": "{{value}} 分钟", "time.minutes": "{{value}} 分钟", "time.hour": "{{value}} 小时", - "time.hours": "{{value}} 小时" + "time.hours": "{{value}} 小时", + "task.error-occurred": "发生错误 ({{errorcode}})", + "settings.file-count": "({{count}} 个文件)", + "settings.total-count": "(共计: {{count}}个)" }, "options": { "dir.name": "下载路径", diff --git a/app/scripts/config/language-default.js b/app/scripts/config/language-default.js index 54c07de..1dd3b91 100644 --- a/app/scripts/config/language-default.js +++ b/app/scripts/config/language-default.js @@ -54,7 +54,6 @@ 'Remain Time': 'Remain', 'Download Speed': 'Download Speed', 'Upload Speed': 'Upload Speed', - 'Files': 'Files', 'Overview': 'Overview', 'Blocks': 'Blocks', 'File List': 'File List', @@ -87,7 +86,6 @@ 'Loading': 'Loading...', 'More Than One Day': 'More than 1 day', 'Unknown': 'Unknown', - 'Total Count': 'Total Count', 'Bytes': 'Bytes', 'Hours': 'Hours', 'Minutes': 'Minutes', @@ -119,6 +117,9 @@ 'time.minutes': '{{value}} Minutes', 'time.hour': '{{value}} Hour', 'time.hours': '{{value}} Hours', + 'task.error-occurred': 'Error Occurred ({{errorcode}})', + 'settings.file-count': '({{count}} Files)', + 'settings.total-count': '(Total Count: {{count}})' }, 'options': { 'dir.name': 'Download Path', diff --git a/app/scripts/filters/taskStatus.js b/app/scripts/filters/taskStatus.js index 2f21f95..eee82a0 100644 --- a/app/scripts/filters/taskStatus.js +++ b/app/scripts/filters/taskStatus.js @@ -1,7 +1,7 @@ (function () { 'use strict'; - angular.module("ariaNg").filter('taskStatus', ['$translate', function ($translate) { + angular.module("ariaNg").filter('taskStatus', function () { return function (task) { if (!task) { return ''; @@ -9,23 +9,23 @@ if (task.status == 'active') { if (task.seeder === true || task.seeder === 'true') { - return $translate.instant('Seeding'); + return 'Seeding'; } else { - return $translate.instant('Downloading'); + return 'Downloading'; } } else if (task.status == 'waiting') { - return $translate.instant('Waiting'); + return 'Waiting'; } else if (task.status == 'paused') { - return $translate.instant('Paused'); + return 'Paused'; } else if (task.status == 'complete') { - return $translate.instant('Completed'); + return 'Completed'; } else if (task.status == 'error') { - return $translate.instant('Error Occurred') + (task.errorCode ? ' (' + task.errorCode + ')' : ''); + return (task.errorCode ? 'format.task.error-occurred' : 'Error Occurred'); } else if (task.status == 'removed') { - return $translate.instant('Removed'); + return 'Removed'; } else { return ''; } } - }]); + }); })(); diff --git a/app/views/list.html b/app/views/list.html index 320963a..5a8a399 100644 --- a/app/views/list.html +++ b/app/views/list.html @@ -44,7 +44,7 @@
- +
diff --git a/app/views/setting.html b/app/views/setting.html index de590b8..ec8825f 100644 --- a/app/views/setting.html +++ b/app/views/setting.html @@ -5,7 +5,7 @@ + ng-bind="'format.settings.total-count' | translate: {count: getTotalCount()}">
diff --git a/app/views/task-detail.html b/app/views/task-detail.html index 0a2ff25..7c27572 100644 --- a/app/views/task-detail.html +++ b/app/views/task-detail.html @@ -37,7 +37,7 @@
- +
@@ -45,7 +45,7 @@ Task Status
- +