From d68be6358597291c39af3d68831a9b02b3ddfcfe Mon Sep 17 00:00:00 2001 From: kunw Date: Wed, 6 Jul 2016 20:22:45 +0800 Subject: [PATCH] update for i18n reviews and other refinements. --- .../replication/create-policy.directive.html | 2 +- .../replication/create-policy.directive.js | 2 +- .../list-replication.directive.html | 10 ++-- .../replication/list-replication.directive.js | 24 ++++++++- .../repository/list-repository.directive.html | 2 +- .../destination.directive.html | 4 +- .../destination.directive.js | 4 +- .../replication.directive.html | 2 +- .../components/user/list-user.directive.html | 2 +- .../js/components/user/list-user.directive.js | 4 +- .../js/services/i18n/locale_messages_en-US.js | 49 +++++++++---------- .../js/services/i18n/locale_messages_zh-CN.js | 47 +++++++++--------- views/project.htm | 2 +- views/sign-in.htm | 2 +- 14 files changed, 87 insertions(+), 69 deletions(-) diff --git a/static/resources/js/components/replication/create-policy.directive.html b/static/resources/js/components/replication/create-policy.directive.html index ed5f2e517b..71e8f1c70d 100644 --- a/static/resources/js/components/replication/create-policy.directive.html +++ b/static/resources/js/components/replication/create-policy.directive.html @@ -64,7 +64,7 @@
- +
// 'endpoint_is_required' | tr //
diff --git a/static/resources/js/components/replication/create-policy.directive.js b/static/resources/js/components/replication/create-policy.directive.js index b1bc16a026..f3079cafdb 100644 --- a/static/resources/js/components/replication/create-policy.directive.js +++ b/static/resources/js/components/replication/create-policy.directive.js @@ -312,7 +312,7 @@ } function pingDestinationFailed(data, status) { vm.pingAvailable = true; - vm.pingMessage = $filter('tr')('failed_to_ping_target', []) + (data && data.length > 0 ? ':' + data : '.'); + vm.pingMessage = $filter('tr')('failed_to_ping_target', []) + (data && data.length > 0 ? ':' + data : ''); vm.pingTIP = false; } } diff --git a/static/resources/js/components/replication/list-replication.directive.html b/static/resources/js/components/replication/list-replication.directive.html index bc5a84551d..5e93ef6860 100644 --- a/static/resources/js/components/replication/list-replication.directive.html +++ b/static/resources/js/components/replication/list-replication.directive.html @@ -28,7 +28,7 @@ - + @@ -41,8 +41,8 @@

// 'no_replication_policies_add_new' | tr //

// 'no_replication_policies_add_new' | tr //

//r.name//
- - + +
  @@ -91,7 +91,7 @@
- +
@@ -112,7 +112,7 @@ - + diff --git a/static/resources/js/components/replication/list-replication.directive.js b/static/resources/js/components/replication/list-replication.directive.js index e8dbd8c9cf..40d7354ec3 100644 --- a/static/resources/js/components/replication/list-replication.directive.js +++ b/static/resources/js/components/replication/list-replication.directive.js @@ -44,6 +44,8 @@ vm.retrievePolicy = retrievePolicy; vm.retrieveJob = retrieveJob; + + vm.confirmToTogglePolicy = confirmToTogglePolicy; vm.togglePolicy = togglePolicy; vm.downloadLog = downloadLog; @@ -147,9 +149,27 @@ console.log('Selected policy ID:' + vm.policyId); } + + function confirmToTogglePolicy(policyId, enabled, name) { + vm.policyId = policyId; + vm.enabled = enabled; + + var status = $filter('tr')(vm.enabled === 1 ? 'enabled':'disabled'); + + $scope.$emit('modalTitle', $filter('tr')('confirm_to_toggle_policy_title')); + $scope.$emit('modalMessage', $filter('tr')('confirm_to_toggle_policy', [name, status])); + + var emitInfo = { + 'contentType': 'text/html', + 'confirmOnly': false, + 'action': vm.togglePolicy + } + + $scope.$emit('raiseInfo', emitInfo); + } - function togglePolicy(policyId, enabled) { - ToggleReplicationPolicyService(policyId, enabled) + function togglePolicy() { + ToggleReplicationPolicyService(vm.policyId, vm.enabled) .success(toggleReplicationPolicySuccess) .error(toggleReplicationPolicyFailed); } diff --git a/static/resources/js/components/repository/list-repository.directive.html b/static/resources/js/components/repository/list-repository.directive.html index e4c626eaea..518d96611b 100644 --- a/static/resources/js/components/repository/list-repository.directive.html +++ b/static/resources/js/components/repository/list-repository.directive.html @@ -11,7 +11,7 @@
-

// 'no_repositories' | tr //

+

// 'no_repositories' | tr //

diff --git a/static/resources/js/components/system-management/destination.directive.html b/static/resources/js/components/system-management/destination.directive.html index 8dccd16b59..e107103055 100644 --- a/static/resources/js/components/system-management/destination.directive.html +++ b/static/resources/js/components/system-management/destination.directive.html @@ -26,7 +26,7 @@

// 'no_replication_jobs' | tr //

// 'no_replication_jobs' | tr //

//r.repository//
- + @@ -35,7 +35,7 @@ diff --git a/static/resources/js/components/system-management/destination.directive.js b/static/resources/js/components/system-management/destination.directive.js index 5c8d32abc8..e11a304ad5 100644 --- a/static/resources/js/components/system-management/destination.directive.js +++ b/static/resources/js/components/system-management/destination.directive.js @@ -44,11 +44,11 @@ console.log('Action for destination:' + vm.action + ', target ID:' + vm.targetId); } - function confirmToDelete(targetId) { + function confirmToDelete(targetId, name) { vm.selectedTargetId = targetId; $scope.$emit('modalTitle', $filter('tr')('confirm_delete_destination_title')); - $scope.$emit('modalMessage', $filter('tr')('confirm_delete_destination')); + $scope.$emit('modalMessage', $filter('tr')('confirm_delete_destination', [name])); var emitInfo = { 'confirmOnly': false, diff --git a/static/resources/js/components/system-management/replication.directive.html b/static/resources/js/components/system-management/replication.directive.html index e55aeec487..c91818713e 100644 --- a/static/resources/js/components/system-management/replication.directive.html +++ b/static/resources/js/components/system-management/replication.directive.html @@ -28,7 +28,7 @@

// 'no_destinations' | tr //

// 'no_destinations' | tr //

//r.name//   - +
- + diff --git a/static/resources/js/components/user/list-user.directive.html b/static/resources/js/components/user/list-user.directive.html index ea324831cb..ed4d6357da 100644 --- a/static/resources/js/components/user/list-user.directive.html +++ b/static/resources/js/components/user/list-user.directive.html @@ -33,7 +33,7 @@ diff --git a/static/resources/js/components/user/list-user.directive.js b/static/resources/js/components/user/list-user.directive.js index 4f9f97d72b..31b561baf0 100644 --- a/static/resources/js/components/user/list-user.directive.js +++ b/static/resources/js/components/user/list-user.directive.js @@ -32,11 +32,11 @@ .error(deleteUserFailed); } - function confirmToDelete(userId) { + function confirmToDelete(userId, username) { vm.selectedUserId = userId; $scope.$emit('modalTitle', $filter('tr')('confirm_delete_user_title')); - $scope.$emit('modalMessage', $filter('tr')('confirm_delete_user')); + $scope.$emit('modalMessage', $filter('tr')('confirm_delete_user', [username])); var emitInfo = { 'confirmOnly': false, diff --git a/static/resources/js/services/i18n/locale_messages_en-US.js b/static/resources/js/services/i18n/locale_messages_en-US.js index 286f80603c..6d48c46205 100644 --- a/static/resources/js/services/i18n/locale_messages_en-US.js +++ b/static/resources/js/services/i18n/locale_messages_en-US.js @@ -128,18 +128,17 @@ var locale_messages = { 'alert_delete_tag': 'Delete tag "$0" now?', 'close': 'Close', 'ok': 'OK', - 'welcome': 'Welcome ', - 'to_harbor': ' to Harbor!', + 'welcome': 'Welcome to Harbor!', 'continue' : 'Continue', - 'no_projects_add_new_project': 'No projects, add new project now.', + 'no_projects_add_new_project': 'No projects available now.', 'no_repositories': 'No repositories found, please use "docker push" to upload images.', 'failed_to_add_member': 'Project member can not be added, insuffient permissions.', 'failed_to_change_member': 'Project member can not be changed, insuffient permissions.', 'failed_to_delete_member': 'Project member can not be deleted, insuffient permissions.', - 'confirm_delete_user_title': 'Delete user', - 'confirm_delete_user': 'Are you sure to delete the current user?', - 'confirm_delete_destination_title': 'Delete destination', - 'confirm_delete_destination': 'Are you sure to delete the current destination?', + 'confirm_delete_user_title': 'User Deletion', + 'confirm_delete_user': 'Are you sure to delete the user "$0" ?', + 'confirm_delete_destination_title': 'Destination Deletion', + 'confirm_delete_destination': 'Are you sure to delete the destination "$0" ?', 'replication': 'Replication', 'name': 'Name', 'description': 'Description', @@ -156,48 +155,46 @@ var locale_messages = { 'enable': 'Enable', 'disabled': 'Disabled', 'disable': 'Disable', - 'no_replication_policies_add_new': 'No replication policies, add new replication policy.', + 'no_replication_policies_add_new': 'No replication policies, please add new policy.', 'no_replication_policies': 'No replication policies.', 'no_replication_jobs': 'No replication jobs.', - 'no_destinations': 'No destinations, add new destination.', + 'no_destinations': 'No destinations, please add new destination.', 'name_is_required': 'Name is required.', 'name_is_too_long': 'Name is too long. (maximum 20 characters)', - 'description_is_too_long': 'Description is too long. (maximum 20 characters)', - 'enable': 'Enable', + 'description_is_too_long': 'Description is too long. ', 'general_setting': 'General', - 'destination_setting': 'Destination Setting', + 'destination_setting': 'Destination Settings', 'endpoint': 'Endpoint', + 'endpoint_is_required': 'Endpoint is required.', 'test_connection': 'Test connection', 'add_new_destination': 'New Destination', 'edit_destination': 'Edit Destination', 'successful_changed_password': 'Password has been changed successfully.', 'change_profile': 'Change Profile', 'successful_changed_profile': 'User profile has been changed successfully.', - 'form_is_invalid': 'Form content is invalid', - 'form_is_invalid_message': 'Form content is invalid, please fill the required fields.', 'administrator': 'Administrator', 'popular_repositories': 'Popular Repositories', 'harbor_intro_title': 'About Harbor', - 'mail_has_been_sent': 'Resetting Email has been sent.', + 'mail_has_been_sent': 'Password resetting Email has been sent.', 'send': 'Send', 'successful_signed_up': 'Signed up successfully.', 'add_new_policy': 'Add New Policy', 'edit_policy': 'Edit Policy', 'add_new_title': 'Add User', 'add_new': 'Add', - 'successful_added': 'Added new user successfully.', + 'successful_added': 'New user added successfully.', 'copyright': 'Copyright', 'all_rights_reserved': 'All Rights Reserved.', - 'pinging_target': 'Testing connection, please stand by...', - 'successful_ping_target': 'Test connection successfully.', - 'failed_to_ping_target': 'Cannot connect to the target.', - 'policy_already_exists': 'Policy alreay exists.', + 'pinging_target': 'Testing connection ...', + 'successful_ping_target': 'Connection tested successfully.', + 'failed_to_ping_target': 'Connetion test failed, please check your settings.', + 'policy_already_exists': 'Policy already exists.', 'destination_already_exists': 'Destination already exists.', 'refresh': 'Refresh', 'select_all': 'Select All', 'delete_tag': 'Delete Tag', 'delete_repo': 'Delete Repo', - 'download_log': 'Download Logs', + 'download_log': 'View Logs', 'edit': 'Edit', 'delete': 'Delete', 'transfer': 'Transfer', @@ -244,11 +241,13 @@ var locale_messages = { 'developer': 'Developer', 'guest': 'Guest', 'inline_help_role_title': 'The Definitions of Roles', - 'inline_help_role': 'Project Admin: When creating a new project, you will be assigned the "ProjectAdmin" role to the project. Besides read-write privileges, the "ProjectAdmin" also has some management privileges, such as adding and removing members.
' + - 'Developer: Developer has read and write privileges for a project.
' + + 'inline_help_role': 'Project Admin: Project Admin has read/write and member management privileges to the project.
' + + 'Developer: Developer has read and write privileges to the project.
' + 'Guest: Guest has read-only privilege for a specified project.', 'inline_help_publicity_title': 'Publicity of Project', 'inline_help_publicity': 'Setting the project as public.', - 'alert_job_contains_error': 'Found errors in the current replication jobs, please look into it.', - 'caution': 'Caution' + 'alert_job_contains_error': 'Found errors in the current replication jobs, please check.', + 'caution': 'Caution', + 'confirm_to_toggle_policy_title': 'Policy Toggle', + 'confirm_to_toggle_policy': 'Are you sure to toggle policy $0 to $1 status?' }; diff --git a/static/resources/js/services/i18n/locale_messages_zh-CN.js b/static/resources/js/services/i18n/locale_messages_zh-CN.js index bfdd677e48..e79f785389 100644 --- a/static/resources/js/services/i18n/locale_messages_zh-CN.js +++ b/static/resources/js/services/i18n/locale_messages_zh-CN.js @@ -127,18 +127,17 @@ var locale_messages = { 'alert_delete_tag': '删除镜像标签 "$0" ?', 'close': '关闭', 'ok': '确认', - 'welcome': '欢迎 ', - 'to_harbor': ' 使用Harbor!', + 'welcome': '欢迎使用Harbor!', 'continue' : '继续', - 'no_projects_add_new_project': '当前没有项目,请新增项目。', + 'no_projects_add_new_project': '当前没有项目。', 'no_repositories': '未发现镜像,请用"docker push"命令上传镜像。', 'failed_to_add_member': '无法添加项目成员,权限不足。', 'failed_to_change_member': '无法修改项目成员,权限不足。', 'failed_to_delete_member': '无法删除项目成员,权限不足。', 'confirm_delete_user_title': '删除用户', - 'confirm_delete_user': '确认删除当前用户吗?', - 'confirm_delete_user_titlen_title': '删除目标', - 'confirm_delete_destination': '确认删除当前目标吗?', + 'confirm_delete_user': '确认删除用户 "$0" ?', + 'confirm_delete_destination_title': '删除目标', + 'confirm_delete_destination': '确认删除目标 "$0"?', 'replication': '复制', 'name': '名称', 'description': '描述', @@ -162,7 +161,7 @@ var locale_messages = { 'no_destinations': '没有目标设置,请新增目标。', 'name_is_required': '名称为必填项', 'name_is_too_long': '名称长度超出限制。(最长为20个字符)', - 'description_is_too_long': '描述内容长度超出限制。(最长为20个字符)', + 'description_is_too_long': '描述内容长度超出限制。', 'general_setting': '一般设置', 'destination_setting': '目标设置', 'endpoint': '终端URL', @@ -171,10 +170,8 @@ var locale_messages = { 'add_new_destination': '新建目标', 'edit_destination': '编辑目标', 'successful_changed_password': '修改密码操作成功。', - 'change_profile': '修改个人信息', - 'successful_changed_profile': '修改个人信息操作成功。', - 'form_is_invalid': '表单内容无sign_up效', - 'form_is_invalid_message': '表单内容无效,请填写必填字段。', + 'change_profile': '修改账户信息', + 'successful_changed_profile': '修改账户信息操作成功。', 'administrator': '管理员', 'popular_repositories': '热门镜像仓库', 'harbor_intro_title': '关于 Harbor', @@ -188,16 +185,16 @@ var locale_messages = { 'successful_added': '新增用户成功。', 'copyright': '版权所有', 'all_rights_reserved': '保留所有权利。', - 'pinging_target': '正在测试连接,请稍候……', + 'pinging_target': '正在测试连接……', 'successful_ping_target': '测试连接目标成功。', - 'failed_to_ping_target': '测试连接目标失败', + 'failed_to_ping_target': '测试连接目标失败,请检查设置。', 'policy_already_exists': '策略已存在。', 'destination_already_exists': '目标已存在。', 'refresh': '刷新', 'select_all': '全选', 'delete_tag': '删除镜像标签', 'delete_repo': '删除镜像仓库', - 'download_log': '下载日志', + 'download_log': '查看日志', 'edit': '修改', 'delete': '删除', 'all': '全部', @@ -212,12 +209,12 @@ var locale_messages = { 'failed_to_get_project_member': '无法获取当前项目成员。', 'failed_to_delete_repo': '无法删除镜像仓库。', 'failed_to_delete_repo_insuffient_permissions': '无法删除镜像仓库,权限不足。', - 'failed_to_get_tag': '获得tag数据失败。', - 'failed_to_get_log': '获取log数据失败。', - 'failed_to_get_project': '获取project数据失败。', + 'failed_to_get_tag': '获取标签数据失败。', + 'failed_to_get_log': '获取日志数据失败。', + 'failed_to_get_project': '获取项目数据失败。', 'failed_to_update_user': '更新用户信息失败。', 'failed_to_get_stat': '获取统计数据失败。', - 'failed_to_get_top_repo': '获取Top镜像仓库数据失败。', + 'failed_to_get_top_repo': '获取热门镜像仓库数据失败。', 'failed_to_get_user_log': '获取用户日志数据失败。', 'failed_to_send_email': '发送邮件失败。', 'failed_to_reset_pasword': '重置邮件失败。', @@ -238,17 +235,19 @@ var locale_messages = { 'failed_to_delete_destination': '删除目标失败。', 'failed_to_create_destination': '创建目标失败。', 'failed_to_update_destination': '修改目标失败。', - 'failed_to_toggle_publicity_insuffient_permissions': '切换项目公开失败,权限不足。', - 'failed_to_toggle_publicity': '切换项目公开失败。', + 'failed_to_toggle_publicity_insuffient_permissions': '切换项目公开性失败,权限不足。', + 'failed_to_toggle_publicity': '切换项目公开性失败。', 'project_admin': '项目管理员', 'developer': '开发人员', - 'guest': '来宾用户', + 'guest': '访客', 'inline_help_role_title': '角色定义', - 'inline_help_role': '项目管理员: 当创建一个新项目后,您将被指派一个“项目管理员”角色。除了具备读/写权限外,“项目管理员”还拥有添加、删除其他项目成员的管理权限。
'+ + 'inline_help_role': '项目管理员: “项目管理员”拥有一个项目的读/写和成员管理的权限。
'+ '开发人员: “开发人员” 拥有一个项目的读/写权限。
' + - '来宾用户: “来宾用户”拥有特定项目的只读权限。', + '访客: “访客”拥有特定项目的只读权限。', 'inline_help_publicity_title': '公开项目', 'inline_help_publicity': '设置该项目为公开。', 'alert_job_contains_error': '当前复制任务中包含错误,请检查。', - 'caution': '注意' + 'caution': '注意', + 'confirm_to_toggle_policy_title': '切换复制策略状态', + 'confirm_to_toggle_policy': '确认将复制策略 $0 切换为 $1 状态吗?' }; diff --git a/views/project.htm b/views/project.htm index d8ab182d6b..84cd2cb400 100644 --- a/views/project.htm +++ b/views/project.htm @@ -40,7 +40,7 @@

// 'no_replication_policies' | tr //

// 'no_replication_policies' | tr //

//r.name// -    +   
- + diff --git a/views/sign-in.htm b/views/sign-in.htm index 6ac8b0aef0..a02eaaf758 100644 --- a/views/sign-in.htm +++ b/views/sign-in.htm @@ -1,6 +1,6 @@ {{ if eq .HasLoggedIn true }}
-

// 'welcome' | tr // {{ .Username }} // 'to_harbor' | tr //

+

// 'welcome' | tr //

// 'no_projects_add_new_project' | tr //

// 'no_projects_add_new_project' | tr //

//p.name//