From 1986efebda400b0c0a1a2164e0a264e6e4697560 Mon Sep 17 00:00:00 2001 From: Jared Tabor Date: Mon, 30 Jul 2018 16:46:32 -0700 Subject: [PATCH] More Translations --- awx/ui/client/features/jobs/jobs.strings.js | 4 ++- .../client/features/jobs/jobsList.view.html | 4 ++- .../features/templates/templates.strings.js | 4 --- .../templates/templatesList.controller.js | 8 +++++ .../templates/templatesList.view.html | 6 ++-- .../components/list/row-action.directive.js | 3 +- .../components/list/row-action.partial.html | 5 +++- .../lib/components/list/row-item.partial.html | 8 +++-- .../lib/services/base-string.service.js | 6 ++++ .../lists/jobs/jobs-list.directive.js | 13 +++----- .../lists/jobs/jobs-list.partial.html | 4 +-- .../hosts/hosts.partial.html | 8 ++--- .../hosts/list/host-list.controller.js | 1 + .../inventory-hosts.strings.js | 17 +++++++++-- .../organizations-projects.controller.js | 30 +++++++++---------- .../linkout/organizations-linkout.route.js | 4 +-- .../projects/list/projects-list.controller.js | 2 +- awx/ui/client/src/projects/projects.form.js | 2 +- .../client/src/scheduler/scheduler.strings.js | 8 +++++ .../src/scheduler/schedulerList.controller.js | 10 +++---- 20 files changed, 93 insertions(+), 54 deletions(-) diff --git a/awx/ui/client/features/jobs/jobs.strings.js b/awx/ui/client/features/jobs/jobs.strings.js index c2fc5e12f5..d888d293cf 100644 --- a/awx/ui/client/features/jobs/jobs.strings.js +++ b/awx/ui/client/features/jobs/jobs.strings.js @@ -14,7 +14,9 @@ function JobsStrings (BaseString) { ROW_ITEM_LABEL_INVENTORY: t.s('Inventory'), ROW_ITEM_LABEL_PROJECT: t.s('Project'), ROW_ITEM_LABEL_CREDENTIALS: t.s('Credentials'), - NO_RUNNING: t.s('There are no running jobs.') + NO_RUNNING: t.s('There are no running jobs.'), + JOB: t.s('Job'), + STATUS_TOOLTIP: status => t.s('Job {{status}}. Click for details.', { status }) }; } diff --git a/awx/ui/client/features/jobs/jobsList.view.html b/awx/ui/client/features/jobs/jobsList.view.html index c5856604c4..580a35d8a7 100644 --- a/awx/ui/client/features/jobs/jobsList.view.html +++ b/awx/ui/client/features/jobs/jobsList.view.html @@ -20,7 +20,7 @@ @@ -76,6 +76,7 @@ ng-show="job.summary_fields.user_capabilities.start"> + ng-show="!vm.isPortalMode && template.summary_fields.user_capabilities.copy" + tooltip="{{:: vm.strings.get('listActions.COPY', vm.getType(template)) }}"> + ng-show="!vm.isPortalMode && template.summary_fields.user_capabilities.delete" + tooltip="{{:: vm.strings.get('listActions.DELETE', vm.getType(template)) }}"> diff --git a/awx/ui/client/lib/components/list/row-action.directive.js b/awx/ui/client/lib/components/list/row-action.directive.js index 18b1835499..7cc7f44a04 100644 --- a/awx/ui/client/lib/components/list/row-action.directive.js +++ b/awx/ui/client/lib/components/list/row-action.directive.js @@ -7,7 +7,8 @@ function atRowAction () { transclude: true, templateUrl, scope: { - icon: '@' + icon: '@', + tooltip: '@' } }; } diff --git a/awx/ui/client/lib/components/list/row-action.partial.html b/awx/ui/client/lib/components/list/row-action.partial.html index 58a7479769..b26301f198 100644 --- a/awx/ui/client/lib/components/list/row-action.partial.html +++ b/awx/ui/client/lib/components/list/row-action.partial.html @@ -1,4 +1,7 @@
+ ng-class="{'at-RowAction--danger': (icon === 'fa-trash' || icon === 'fa-times')}" + aw-tool-tip="{{tooltip}}" + data-tip-watch="tooltip" + data-placement="top">
diff --git a/awx/ui/client/lib/components/list/row-item.partial.html b/awx/ui/client/lib/components/list/row-item.partial.html index f9119930a5..4ff2c2d01d 100644 --- a/awx/ui/client/lib/components/list/row-item.partial.html +++ b/awx/ui/client/lib/components/list/row-item.partial.html @@ -2,11 +2,15 @@ ng-show="status || headerValue || value || valueBindHtml || (smartStatus && smartStatus.summary_fields.recent_jobs.length) || (tagValues && tagValues.length)">
- +
+ +
{{ headerValue }} diff --git a/awx/ui/client/lib/services/base-string.service.js b/awx/ui/client/lib/services/base-string.service.js index 649f33a486..536e47624c 100644 --- a/awx/ui/client/lib/services/base-string.service.js +++ b/awx/ui/client/lib/services/base-string.service.js @@ -93,6 +93,12 @@ function BaseStringService (namespace) { CALL: ({ path, action, status }) => t.s('Call to {{ path }} failed. {{ action }} returned status: {{ status }}.', { path, action, status }), }; + this.listActions = { + COPY: resourceType => t.s('Copy {{resourceType}}', { resourceType }), + DELETE: resourceType => t.s('Delete the {{resourceType}}', { resourceType }), + CANCEL: resourceType => t.s('Cancel the {{resourceType}}', { resourceType }) + }; + this.ALERT = ({ header, body }) => t.s('{{ header }} {{ body }}', { header, body }); /** diff --git a/awx/ui/client/src/home/dashboard/lists/jobs/jobs-list.directive.js b/awx/ui/client/src/home/dashboard/lists/jobs/jobs-list.directive.js index 07d95ab21d..cd7ad27842 100644 --- a/awx/ui/client/src/home/dashboard/lists/jobs/jobs-list.directive.js +++ b/awx/ui/client/src/home/dashboard/lists/jobs/jobs-list.directive.js @@ -4,7 +4,8 @@ export default 'templateUrl', '$location', 'i18n', - function JobsList($filter, templateUrl, $location, i18n) { + 'JobsStrings', + function JobsList($filter, templateUrl, $location, i18n, strings) { return { restrict: 'E', link: link, @@ -15,6 +16,7 @@ export default }; function link(scope, element, attr) { + scope.strings = strings; scope.$watch("data", function(data) { if (data) { if (data.length > 0) { @@ -37,14 +39,7 @@ export default } else { detailsUrl = `/#/jobs/playbook/${job.id}`; } - - if(_.has(job, 'status') && job.status === 'successful'){ - tooltip = i18n._('Job successful. Click for details.'); - } - else if(_.has(job, 'status') && job.status === 'failed'){ - tooltip = i18n._('Job failed. Click for details.'); - } - + return { detailsUrl, status: job.status, diff --git a/awx/ui/client/src/home/dashboard/lists/jobs/jobs-list.partial.html b/awx/ui/client/src/home/dashboard/lists/jobs/jobs-list.partial.html index 790600c33a..61a1d799ba 100644 --- a/awx/ui/client/src/home/dashboard/lists/jobs/jobs-list.partial.html +++ b/awx/ui/client/src/home/dashboard/lists/jobs/jobs-list.partial.html @@ -16,10 +16,10 @@ - + - + diff --git a/awx/ui/client/src/inventories-hosts/hosts/hosts.partial.html b/awx/ui/client/src/inventories-hosts/hosts/hosts.partial.html index 75bebe0e23..87aec2c409 100644 --- a/awx/ui/client/src/inventories-hosts/hosts/hosts.partial.html +++ b/awx/ui/client/src/inventories-hosts/hosts/hosts.partial.html @@ -50,7 +50,7 @@ -
+
@@ -74,13 +74,13 @@
- - -
diff --git a/awx/ui/client/src/inventories-hosts/hosts/list/host-list.controller.js b/awx/ui/client/src/inventories-hosts/hosts/list/host-list.controller.js index bdb7607389..a895c589ab 100644 --- a/awx/ui/client/src/inventories-hosts/hosts/list/host-list.controller.js +++ b/awx/ui/client/src/inventories-hosts/hosts/list/host-list.controller.js @@ -17,6 +17,7 @@ function HostsList($scope, HostsList, $rootScope, GetBasePath, $scope.canAdd = canAdd; $scope.enableSmartInventoryButton = false; $scope.smartInventoryButtonTooltip = InventoryHostsStrings.get('smartinventorybutton.DISABLED_INSTRUCTIONS'); + $scope.strings = InventoryHostsStrings; // Search init $scope.list = list; diff --git a/awx/ui/client/src/inventories-hosts/inventory-hosts.strings.js b/awx/ui/client/src/inventories-hosts/inventory-hosts.strings.js index 45c94e7820..a5b35168ad 100644 --- a/awx/ui/client/src/inventories-hosts/inventory-hosts.strings.js +++ b/awx/ui/client/src/inventories-hosts/inventory-hosts.strings.js @@ -21,6 +21,19 @@ function InventoryHostsStrings (BaseString) { DELETE_HOST: count => t.p(count, 'Delete host', 'Delete hosts'), }; + ns.inventory = { + EDIT_HOST: t.s('Edit host'), + VIEW_HOST: t.s('View host'), + VIEW_INSIGHTS: t.s('View Insights Data') + }; + + ns.hostList = { + DISABLED_TOGGLE_TOOLTIP: () => t.s('{{ str1 }}

{{ str2 }}

', { + str1: t.s('Indicates if a host is available and should be included in running jobs.'), + str2: t.s('For hosts that are part of an external inventory, this flag cannot be changed. It will be set by the inventory sync process.') + }) + }; + ns.smartinventories = { hostfilter: { MISSING_ORG: t.s('Please select an organization before editing the host filter.'), @@ -30,8 +43,8 @@ function InventoryHostsStrings (BaseString) { }; ns.smartinventorybutton = { - DISABLED_INSTRUCTIONS: "Please enter at least one search term to create a new Smart Inventory.", - ENABLED_INSTRUCTIONS: "Create a new Smart Inventory from search results.

Note: changing the organization of the Smart Inventory could change the hosts included in the Smart Inventory." + DISABLED_INSTRUCTIONS: t.s("Please enter at least one search term to create a new Smart Inventory."), + ENABLED_INSTRUCTIONS: t.s("Create a new Smart Inventory from search results.

Note: changing the organization of the Smart Inventory could change the hosts included in the Smart Inventory.") }; } diff --git a/awx/ui/client/src/organizations/linkout/controllers/organizations-projects.controller.js b/awx/ui/client/src/organizations/linkout/controllers/organizations-projects.controller.js index a12108c366..0a3ddcf57d 100644 --- a/awx/ui/client/src/organizations/linkout/controllers/organizations-projects.controller.js +++ b/awx/ui/client/src/organizations/linkout/controllers/organizations-projects.controller.js @@ -7,11 +7,11 @@ export default ['$scope', '$rootScope', '$log', '$stateParams', 'Rest', 'Alert', 'OrgProjectList', 'OrgProjectDataset', 'ProcessErrors', 'GetBasePath', 'ProjectUpdate', 'Wait', 'GetChoices', 'Empty', 'Find', 'GetProjectIcon', - 'GetProjectToolTip', '$filter', '$state', + 'GetProjectToolTip', '$filter', '$state', 'i18n', function($scope, $rootScope, $log, $stateParams, Rest, Alert, OrgProjectList, Dataset, ProcessErrors, GetBasePath, ProjectUpdate, Wait, GetChoices, Empty, Find, GetProjectIcon, GetProjectToolTip, $filter, - $state) { + $state, i18n) { var list = OrgProjectList, projUrl, @@ -35,15 +35,15 @@ export default ['$scope', '$rootScope', '$log', '$stateParams', 'Rest', 'Alert', $scope.projects.forEach(function(project, i) { $scope.projects[i].statusIcon = GetProjectIcon(project.status); $scope.projects[i].statusTip = GetProjectToolTip(project.status); - $scope.projects[i].scm_update_tooltip = "Get latest SCM revision"; + $scope.projects[i].scm_update_tooltip = i18n._("Get latest SCM revision"); $scope.projects[i].scm_type_class = ""; if (project.status === 'failed' && project.summary_fields.last_update && project.summary_fields.last_update.status === 'canceled') { - $scope.projects[i].statusTip = 'Canceled. Click for details'; + $scope.projects[i].statusTip = i18n._('Canceled. Click for details'); } if (project.status === 'running' || project.status === 'updating') { - $scope.projects[i].scm_update_tooltip = "SCM update currently running"; + $scope.projects[i].scm_update_tooltip = i18n._("SCM update currently running"); $scope.projects[i].scm_type_class = "btn-disabled"; } @@ -51,7 +51,7 @@ export default ['$scope', '$rootScope', '$log', '$stateParams', 'Rest', 'Alert', if (type.value === project.scm_type) { $scope.projects[i].scm_type = type.label; if (type.label === 'Manual') { - $scope.projects[i].scm_update_tooltip = 'Manual projects do not require an SCM update'; + $scope.projects[i].scm_update_tooltip = i18n._('Manual projects do not require an SCM update'); $scope.projects[i].scm_type_class = 'btn-disabled'; $scope.projects[i].statusTip = 'Not configured for SCM'; $scope.projects[i].statusIcon = 'none'; @@ -116,7 +116,7 @@ export default ['$scope', '$rootScope', '$log', '$stateParams', 'Rest', 'Alert', $log.debug('Received event for project: ' + project.name); $log.debug('Status changed to: ' + data.status); if (!(data.status === 'successful' || data.status === 'failed')) { - project.scm_update_tooltip = "SCM update currently running"; + project.scm_update_tooltip = i18n._("SCM update currently running"); project.scm_type_class = "btn-disabled"; } project.status = data.status; @@ -188,8 +188,7 @@ export default ['$scope', '$rootScope', '$log', '$stateParams', 'Rest', 'Alert', $state.go('output', { id: id, type: 'project' }); } else { - Alert('No Updates Available', 'There is no SCM update information available for this project. An update has not yet been ' + - ' completed. If you have not already done so, start an update for this project.', 'alert-info'); + Alert(i18n._('No Updates Available'), i18n._('There is no SCM update information available for this project. An update has not yet been completed. If you have not already done so, start an update for this project.'), 'alert-info'); } }); @@ -197,8 +196,7 @@ export default ['$scope', '$rootScope', '$log', '$stateParams', 'Rest', 'Alert', // Refresh the project list var project = Find({ list: $scope.projects, key: 'id', val: id }); if (Empty(project.scm_type) || project.scm_type === 'Manual') { - Alert('No SCM Configuration', 'The selected project is not configured for SCM. To configure for SCM, edit the project and provide SCM settings, ' + - 'and then run an update.', 'alert-info'); + Alert(i18n._('No SCM Configuration'), i18n._('The selected project is not configured for SCM. To configure for SCM, edit the project and provide SCM settings and then run an update.'), 'alert-info'); } else { // Refresh what we have in memory to insure we're accessing the most recent status record Rest.setUrl(project.url); @@ -223,7 +221,7 @@ export default ['$scope', '$rootScope', '$log', '$stateParams', 'Rest', 'Alert', Rest.setUrl(url); Rest.post() .then(() => { - Alert('SCM Update Cancel', 'Your request to cancel the update was submitted to the task manager.', 'alert-info'); + Alert(i18n._('SCM Update Cancel'), i18n._('Your request to cancel the update was submitted to the task manager.'), 'alert-info'); $scope.refresh(); }) .catch(({data, status}) => { @@ -243,8 +241,8 @@ export default ['$scope', '$rootScope', '$log', '$stateParams', 'Rest', 'Alert', if (data.can_cancel) { $scope.$emit('Cancel_Update', url); } else { - Alert('Cancel Not Allowed', '
Either you do not have access or the SCM update process completed. ' + - 'Click the Refresh button to view the latest status.
', 'alert-info', null, null, null, null, true); + Alert(i18n._('Cancel Not Allowed'), `
${i18n._('Either you do not have access or the SCM update process completed. Click the ')} + ${i18n._('Refresh')} ${i18n._('button to view the latest status.')}
`, 'alert-info', null, null, null, null, true); } }) .catch(({data, status}) => { @@ -269,8 +267,8 @@ export default ['$scope', '$rootScope', '$log', '$stateParams', 'Rest', 'Alert', }); }); } else { - Alert('Update Not Found', '
An SCM update does not appear to be running for project: ' + $filter('sanitize')(name) + '. Click the Refresh ' + - 'button to view the latest status.
', 'alert-info', undefined, undefined, undefined, undefined, true); + Alert(i18n._('Update Not Found'), `
${i18n._('An SCM update does not appear to be running for project: ')} ${$filter('sanitize')(name)}. ${i18n._('Click the')} ${i18n._('Refresh')}${i18n._('button to view the latest status.')}
`, + 'alert-info', undefined, undefined, undefined, undefined, true); } }) .catch(({data, status}) => { diff --git a/awx/ui/client/src/organizations/linkout/organizations-linkout.route.js b/awx/ui/client/src/organizations/linkout/organizations-linkout.route.js index b0161b2a89..33dbc25983 100644 --- a/awx/ui/client/src/organizations/linkout/organizations-linkout.route.js +++ b/awx/ui/client/src/organizations/linkout/organizations-linkout.route.js @@ -155,7 +155,7 @@ let lists = [{ list.title = true; list.listTitle = N_('Inventories') + ` | {{ name }}`; list.basePath = `${GetBasePath('organizations')}${$stateParams.organization_id}/inventories`; - list.emptyListText = "This list is populated by inventories added from the 
Inventories section"; + list.emptyListText = `${N_("This list is populated by inventories added from the")} ${N_("Inventories")} ${N_("section")}`; return list; }], OrgInventoryDataset: ['OrgInventoryList', 'QuerySet', '$stateParams', 'GetBasePath', @@ -206,7 +206,7 @@ let lists = [{ delete list.fieldActions.delete; list.listTitle = N_('Projects') + ` | {{ name }}`; list.basePath = `${GetBasePath('organizations')}${$stateParams.organization_id}/projects`; - list.emptyListText = "This list is populated by projects added from the Projects section"; + list.emptyListText = `${N_("This list is populated by projects added from the")} ${N_("Projects")} ${N_("section")}`; return list; }], OrgProjectDataset: ['OrgProjectList', 'QuerySet', '$stateParams', 'GetBasePath', diff --git a/awx/ui/client/src/projects/list/projects-list.controller.js b/awx/ui/client/src/projects/list/projects-list.controller.js index a6136bc39a..11be31c54c 100644 --- a/awx/ui/client/src/projects/list/projects-list.controller.js +++ b/awx/ui/client/src/projects/list/projects-list.controller.js @@ -115,7 +115,7 @@ export default ['$scope', '$rootScope', '$log', 'Rest', 'Alert', if (data.status === 'successful' || data.status === 'failed' || data.status === 'canceled') { $scope.reloadList(); } else { - project.scm_update_tooltip = "SCM update currently running"; + project.scm_update_tooltip = i18n._("SCM update currently running"); project.scm_type_class = "btn-disabled"; } project.status = data.status; diff --git a/awx/ui/client/src/projects/projects.form.js b/awx/ui/client/src/projects/projects.form.js index 9a0b467962..c6315ab954 100644 --- a/awx/ui/client/src/projects/projects.form.js +++ b/awx/ui/client/src/projects/projects.form.js @@ -104,7 +104,7 @@ export default ['i18n', 'NotificationsList', 'TemplateList', ngDisabled: '!(project_obj.summary_fields.user_capabilities.edit || canAdd)' }, scm_url: { - label: 'SCM URL', + label: i18n._('SCM URL'), type: 'text', ngShow: "scm_type && scm_type.value !== 'manual' && scm_type.value !== 'insights' ", awRequiredWhen: { diff --git a/awx/ui/client/src/scheduler/scheduler.strings.js b/awx/ui/client/src/scheduler/scheduler.strings.js index 4d4173e5a3..95b66edfdf 100644 --- a/awx/ui/client/src/scheduler/scheduler.strings.js +++ b/awx/ui/client/src/scheduler/scheduler.strings.js @@ -9,6 +9,14 @@ function SchedulerStrings (BaseString) { EDIT_SCHEDULE: t.s('EDIT SCHEDULE') }; + ns.list = { + CLICK_TO_EDIT: t.s('Click to edit schedule.'), + SCHEDULE_IS_ACTIVE: t.s('Schedule is active.'), + SCHEDULE_IS_ACTIVE_CLICK_TO_STOP: t.s('Schedule is active. Click to stop.'), + SCHEDULE_IS_STOPPED: t.s('Schedule is stopped.'), + SCHEDULE_IS_STOPPED_CLICK_TO_STOP: t.s('Schedule is stopped. Click to activate.') + }; + ns.form = { NAME: t.s('Name'), NAME_REQUIRED_MESSAGE: t.s('A schedule name is required.'), diff --git a/awx/ui/client/src/scheduler/schedulerList.controller.js b/awx/ui/client/src/scheduler/schedulerList.controller.js index e1546c8bc5..5a6ea5e0e1 100644 --- a/awx/ui/client/src/scheduler/schedulerList.controller.js +++ b/awx/ui/client/src/scheduler/schedulerList.controller.js @@ -14,10 +14,10 @@ export default [ '$filter', '$scope', '$location', '$stateParams', 'ScheduleList', 'Rest', 'rbacUiControlService', 'JobTemplateModel', 'ToggleSchedule', 'DeleteSchedule', - '$q', '$state', 'Dataset', 'ParentObject', 'UnifiedJobsOptions', 'i18n', + '$q', '$state', 'Dataset', 'ParentObject', 'UnifiedJobsOptions', 'i18n', 'SchedulerStrings', function($filter, $scope, $location, $stateParams, ScheduleList, Rest, rbacUiControlService, JobTemplate, ToggleSchedule, DeleteSchedule, - $q, $state, Dataset, ParentObject, UnifiedJobsOptions, i18n + $q, $state, Dataset, ParentObject, UnifiedJobsOptions, i18n, strings ) { var base, scheduleEndpoint, @@ -119,12 +119,12 @@ export default [ function buildTooltips(schedule) { var job = schedule.summary_fields.unified_job_template; if (schedule.enabled) { - const tip = (schedule.summary_fields.user_capabilities.edit || $scope.credentialRequiresPassword) ? i18n._('Schedule is active.') : i18n._('Schedule is active. Click to stop.'); + const tip = (schedule.summary_fields.user_capabilities.edit || $scope.credentialRequiresPassword) ? strings.get('list.SCHEDULE_IS_ACTIVE') : strings.get('list.SCHEDULE_IS_ACTIVE_CLICK_TO_STOP'); schedule.play_tip = tip; schedule.status = 'active'; schedule.status_tip = tip; } else { - const tip = (schedule.summary_fields.user_capabilities.edit || $scope.credentialRequiresPassword) ? i18n._('Schedule is stopped.') : i18n._('Schedule is stopped. Click to activate.'); + const tip = (schedule.summary_fields.user_capabilities.edit || $scope.credentialRequiresPassword) ? strings.get('list.SCHEDULE_IS_STOPPED') : strings.get('list.SCHEDULE_IS_STOPPED_CLICK_TO_STOP');//i18n._('Schedule is stopped.') : i18n._('Schedule is stopped. Click to activate.'); schedule.play_tip = tip; schedule.status = 'stopped'; schedule.status_tip = tip; @@ -140,7 +140,7 @@ export default [ schedule.nameTip += "job "; } schedule.nameTip += $filter('sanitize')(job.name); - schedule.nameTip += ". Click to edit schedule."; + schedule.nameTip += `. ${strings.get('list.CLICK_TO_EDIT')}`; } $scope.refreshSchedules = function() {