refactor code
This commit is contained in:
parent
46ea17055f
commit
2b0e844656
|
@ -4,10 +4,6 @@
|
|||
"Error": "错误",
|
||||
"OK": "确定",
|
||||
"Cancel": "取消",
|
||||
"True": "是",
|
||||
"true": "是",
|
||||
"False": "否",
|
||||
"false": "否",
|
||||
"New": "新建",
|
||||
"Start": "开始下载任务",
|
||||
"Pause": "暂停下载任务",
|
||||
|
@ -105,20 +101,6 @@
|
|||
"Disabled": "禁用",
|
||||
"Changes to the settings take effect after refreshing page.": "设置将在页面刷新后生效.",
|
||||
"Type is illegal!": "类型错误!",
|
||||
"none": "无",
|
||||
"http": "Http",
|
||||
"https": "Https",
|
||||
"ftp": "Ftp",
|
||||
"mem": "仅内存",
|
||||
"plain": "明文",
|
||||
"arc4": "ARC4",
|
||||
"binary": "二进制",
|
||||
"ascii": "ASCII",
|
||||
"debug": "调试 (Debug)",
|
||||
"info": "普通 (Info)",
|
||||
"notice": "一般 (Notice)",
|
||||
"warn": "警告 (Warn)",
|
||||
"error": "错误 (Error)",
|
||||
"format": {
|
||||
"time.millisecond": "{{value}} 毫秒",
|
||||
"time.milliseconds": "{{value}} 毫秒",
|
||||
|
@ -138,6 +120,25 @@
|
|||
}
|
||||
},
|
||||
"options": {
|
||||
"true": "是",
|
||||
"false": "否",
|
||||
"default": "默认",
|
||||
"none": "无",
|
||||
"hide": "隐藏",
|
||||
"full": "完整",
|
||||
"http": "Http",
|
||||
"https": "Https",
|
||||
"ftp": "Ftp",
|
||||
"mem": "仅内存",
|
||||
"plain": "明文",
|
||||
"arc4": "ARC4",
|
||||
"binary": "二进制",
|
||||
"ascii": "ASCII",
|
||||
"debug": "调试 (Debug)",
|
||||
"info": "普通 (Info)",
|
||||
"notice": "一般 (Notice)",
|
||||
"warn": "警告 (Warn)",
|
||||
"error": "错误 (Error)",
|
||||
"dir.name": "下载路径",
|
||||
"dir.description": "",
|
||||
"log.name": "日志文件",
|
||||
|
@ -174,7 +175,7 @@
|
|||
"no-proxy.name": "不使用代理服务器列表",
|
||||
"no-proxy.description": "设置不使用代理服务器的主机名, 域名, 包含或不包含子网掩码的网络地址, 多个使用逗号分隔.",
|
||||
"proxy-method.name": "代理服务器请求方法",
|
||||
"proxy-method.description": "设置用来请求代理服务器的方法. 方法可设置为 get 或 tunnel. HTTPS 下载将忽略此选项并总是使用 tunnel.",
|
||||
"proxy-method.description": "设置用来请求代理服务器的方法. 方法可设置为 GET 或 TUNNEL. HTTPS 下载将忽略此选项并总是使用 TUNNEL.",
|
||||
"remote-time.name": "获取服务器文件时间",
|
||||
"remote-time.description": "从 HTTP/FTP 服务获取远程文件的时间戳, 如果可用将设置到本地文件",
|
||||
"reuse-uri.name": "URI 复用",
|
|
@ -11,8 +11,8 @@
|
|||
prefix: 'langs/',
|
||||
suffix: '.json'
|
||||
}).useLoaderCache(true)
|
||||
.preferredLanguage('en-US')
|
||||
.fallbackLanguage('en-US')
|
||||
.preferredLanguage('en')
|
||||
.fallbackLanguage('en')
|
||||
.useSanitizeValueStrategy('escape');
|
||||
}]);
|
||||
})();
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
optionStorageKey: 'Options',
|
||||
lazySaveTimeout: 500
|
||||
}).constant('ariaNgDefaultOptions', {
|
||||
language: 'en-US',
|
||||
language: 'en',
|
||||
rpcHost: '',
|
||||
rpcPort: '6800',
|
||||
protocol: 'http',
|
||||
|
|
|
@ -2,16 +2,12 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('ariaNg').config(['$translateProvider', function ($translateProvider) {
|
||||
$translateProvider.translations('en-US', {
|
||||
$translateProvider.translations('en', {
|
||||
'English': 'English',
|
||||
'Operation Succeeded': 'Operation Succeeded',
|
||||
'Error': 'Error',
|
||||
'OK': 'OK',
|
||||
'Cancel': 'Cancel',
|
||||
'True': 'True',
|
||||
'true': 'True',
|
||||
'False': 'False',
|
||||
'false': 'False',
|
||||
'New': 'New',
|
||||
'Start': 'Start',
|
||||
'Pause': 'Pause',
|
||||
|
@ -109,20 +105,6 @@
|
|||
'Disabled': 'Disabled',
|
||||
'Changes to the settings take effect after refreshing page.': 'Changes to the settings take effect after refreshing page.',
|
||||
'Type is illegal!': 'Type is illegal!',
|
||||
'none': 'None',
|
||||
'http': 'Http',
|
||||
'https': 'Https',
|
||||
'ftp': 'Ftp',
|
||||
'mem': 'Memory Only',
|
||||
'plain': 'Plain',
|
||||
'arc4': 'ARC4',
|
||||
'binary': 'Binary',
|
||||
'ascii': 'ASCII',
|
||||
'debug': 'Debug',
|
||||
'info': 'Info',
|
||||
'notice': 'Notice',
|
||||
'warn': 'Warn',
|
||||
'error': 'Error',
|
||||
'format': {
|
||||
'time.millisecond': '{{value}} Millisecond',
|
||||
'time.milliseconds': '{{value}} Milliseconds',
|
||||
|
@ -142,6 +124,44 @@
|
|||
}
|
||||
},
|
||||
'options': {
|
||||
'true': 'True',
|
||||
'false': 'False',
|
||||
'default': 'Default',
|
||||
'none': 'None',
|
||||
'hide': 'Hide',
|
||||
'full': 'Full',
|
||||
'http': 'Http',
|
||||
'https': 'Https',
|
||||
'ftp': 'Ftp',
|
||||
'mem': 'Memory Only',
|
||||
'get': 'GET',
|
||||
'tunnel': 'TUNNEL',
|
||||
'plain': 'Plain',
|
||||
'arc4': 'ARC4',
|
||||
'binary': 'Binary',
|
||||
'ascii': 'ASCII',
|
||||
'debug': 'Debug',
|
||||
'info': 'Info',
|
||||
'notice': 'Notice',
|
||||
'warn': 'Warn',
|
||||
'error': 'Error',
|
||||
'adaptive': 'adaptive',
|
||||
'epoll': 'epoll',
|
||||
'falloc': 'falloc',
|
||||
'feedback': 'feedback',
|
||||
'geom': 'geom',
|
||||
'inorder': 'inorder',
|
||||
'kqueue': 'kqueue',
|
||||
'poll': 'poll',
|
||||
'port': 'port',
|
||||
'prealloc': 'prealloc',
|
||||
'random': 'random',
|
||||
'select': 'select',
|
||||
'trunc': 'trunc',
|
||||
'SSLv3': 'SSLv3',
|
||||
'TLSv1': 'TLSv1',
|
||||
'TLSv1.1': 'TLSv1.1',
|
||||
'TLSv1.2': 'TLSv1.2',
|
||||
'dir.name': 'Download Path',
|
||||
'dir.description': '',
|
||||
'log.name': 'Log File',
|
||||
|
@ -179,7 +199,7 @@
|
|||
'no-proxy.name': 'No Proxy List',
|
||||
'no-proxy.description': 'Specify a comma separated list of host names, domains and network addresses with or without a subnet mask where no proxy should be used.',
|
||||
'proxy-method.name': 'Proxy Method',
|
||||
'proxy-method.description': 'Set the method to use in proxy request. METHOD is either get or tunnel. HTTPS downloads always use tunnel regardless of this option.',
|
||||
'proxy-method.description': 'Set the method to use in proxy request. METHOD is either GET or TUNNEL. HTTPS downloads always use TUNNEL regardless of this option.',
|
||||
'remote-time.name': 'Remote File Timestamp',
|
||||
'remote-time.description': 'Retrieve timestamp of the remote file from the remote HTTP/FTP server and if it is available, apply it to the local file.',
|
||||
'reuse-uri.name': 'Reuse Uri',
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('ariaNg').constant('ariaNgLanguages', {
|
||||
'en-US': {
|
||||
'en': {
|
||||
name: 'English'
|
||||
},
|
||||
'zh-CN': {
|
||||
'zh_CN': {
|
||||
name: 'Simplified Chinese'
|
||||
}
|
||||
});
|
||||
|
|
|
@ -68,6 +68,23 @@
|
|||
descriptionKey: 'options.' + key + '.description'
|
||||
}, option);
|
||||
|
||||
if (option.type == 'boolean') {
|
||||
option.options = ['true', 'false'];
|
||||
}
|
||||
|
||||
if (option.options) {
|
||||
var availableOptions = [];
|
||||
|
||||
for (var j = 0; j < option.options.length; j++) {
|
||||
availableOptions.push({
|
||||
name: 'options.' + option.options[j],
|
||||
value: option.options[j]
|
||||
});
|
||||
}
|
||||
|
||||
option.options = availableOptions;
|
||||
}
|
||||
|
||||
options.push(option);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,22 +25,11 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" ng-if="option.type == 'boolean'" ng-class="[optionStatus.getStatusFeedbackStyle()]">
|
||||
<div class="has-feedback">
|
||||
<select class="form-control" style="width: 100%;" ng-disabled="!!option.readonly" ng-model="optionValue" ng-change="changeValue(optionValue, false)">
|
||||
<option value="true" translate>True</option>
|
||||
<option value="false" translate>False</option>
|
||||
</select>
|
||||
<div class="form-control-icon" ng-if="optionStatus.isShowStatusIcon()">
|
||||
<span class="fa form-control-feedback" ng-class="[optionStatus.getStatusIcon()]"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" ng-if="option.type == 'option'" ng-class="[optionStatus.getStatusFeedbackStyle()]">
|
||||
<div class="form-group" ng-if="option.type == 'boolean' || option.type == 'option'" ng-class="[optionStatus.getStatusFeedbackStyle()]">
|
||||
<div class="has-feedback">
|
||||
<select class="form-control" style="width: 100%;" ng-disabled="!!option.readonly"
|
||||
ng-model="optionValue" ng-change="changeValue(optionValue, false)"
|
||||
ng-options="(value | translate) for value in option.options">
|
||||
ng-options="value.value as (value.name | translate) for value in option.options">
|
||||
</select>
|
||||
<div class="form-control-icon" ng-if="optionStatus.isShowStatusIcon()">
|
||||
<span class="fa form-control-feedback" ng-class="[optionStatus.getStatusIcon()]"></span>
|
||||
|
|
Reference in a new issue