From 9c95a2c778ff3c04a3c566edaad65995cd2ce6bd Mon Sep 17 00:00:00 2001 From: Ken Hoes Date: Wed, 7 Dec 2016 15:26:12 -0500 Subject: [PATCH] Added i18n parsing to strings --- .../configuration-auth.controller.js | 28 ++++++------ .../auth-form/sub-forms/auth-azure.form.js | 5 ++- .../sub-forms/auth-github-org.form.js | 5 ++- .../sub-forms/auth-github-team.form.js | 5 ++- .../auth-form/sub-forms/auth-github.form.js | 5 ++- .../sub-forms/auth-google-oauth2.form.js | 5 ++- .../auth-form/sub-forms/auth-ldap.form.js | 5 ++- .../auth-form/sub-forms/auth-radius.form.js | 5 ++- .../auth-form/sub-forms/auth-saml.form.js | 5 ++- .../configuration/configuration.controller.js | 44 +++++++++---------- .../configuration-jobs.controller.js | 6 ++- .../jobs-form/configuration-jobs.form.js | 6 +-- .../system-form/configuration-system.form.js | 5 ++- .../ui-form/configuration-ui.controller.js | 6 ++- .../ui-form/configuration-ui.form.js | 5 ++- 15 files changed, 78 insertions(+), 62 deletions(-) diff --git a/awx/ui/client/src/configuration/auth-form/configuration-auth.controller.js b/awx/ui/client/src/configuration/auth-form/configuration-auth.controller.js index 20166f3b85..9d450717f3 100644 --- a/awx/ui/client/src/configuration/auth-form/configuration-auth.controller.js +++ b/awx/ui/client/src/configuration/auth-form/configuration-auth.controller.js @@ -22,6 +22,7 @@ export default [ 'ConfigurationUtils', 'CreateSelect2', 'GenerateForm', + 'i18n', 'ParseTypeChange', function( $scope, @@ -41,6 +42,7 @@ export default [ ConfigurationUtils, CreateSelect2, GenerateForm, + i18n, ParseTypeChange ) { var authVm = this; @@ -60,10 +62,10 @@ export default [ authVm.activeAuthForm = authVm.dropdownValue; formTracker.setCurrentAuth(authVm.activeAuthForm); } else { - var msg = 'You have unsaved changes. Would you like to proceed without saving?'; - var title = 'Warning: Unsaved Changes'; + var msg = i18n._('You have unsaved changes. Would you like to proceed without saving?'); + var title = i18n._('Warning: Unsaved Changes'); var buttons = [{ - label: "Discard changes", + label: i18n._('Discard changes'), "class": "btn Form-cancelButton", "id": "formmodal-cancel-button", onClick: function() { @@ -74,7 +76,7 @@ export default [ $('#FormModal-dialog').dialog('close'); } }, { - label: "Save changes", + label: i18n._('Save changes'), onClick: function() { $scope.$parent.vm.formSave() .then(function() { @@ -94,14 +96,14 @@ export default [ }; var dropdownOptions = [ - {label: 'Azure AD', value: 'azure'}, - {label: 'Github', value: 'github'}, - {label: 'Github Org', value: 'github_org'}, - {label: 'Github Team', value: 'github_team'}, - {label: 'Google OAuth2', value: 'google_oauth'}, - {label: 'LDAP', value: 'ldap'}, - {label: 'RADIUS', value: 'radius'}, - {label: 'SAML', value: 'saml'} + {label: i18n._('Azure AD'), value: 'azure'}, + {label: i18n._('Github'), value: 'github'}, + {label: i18n._('Github Org'), value: 'github_org'}, + {label: i18n._('Github Team'), value: 'github_team'}, + {label: i18n._('Google OAuth2'), value: 'google_oauth'}, + {label: i18n._('LDAP'), value: 'ldap'}, + {label: i18n._('RADIUS'), value: 'radius'}, + {label: i18n._('SAML'), value: 'saml'} ]; CreateSelect2({ @@ -217,7 +219,7 @@ export default [ CreateSelect2({ element: '#configuration_ldap_template_AUTH_LDAP_GROUP_TYPE', multiple: false, - placeholder: 'Select group types', + placeholder: i18n._('Select group types'), opts: opts }); // Fix for bug where adding selected opts causes form to be $dirty and triggering modal diff --git a/awx/ui/client/src/configuration/auth-form/sub-forms/auth-azure.form.js b/awx/ui/client/src/configuration/auth-form/sub-forms/auth-azure.form.js index bf2546ad11..17b36e67fb 100644 --- a/awx/ui/client/src/configuration/auth-form/sub-forms/auth-azure.form.js +++ b/awx/ui/client/src/configuration/auth-form/sub-forms/auth-azure.form.js @@ -4,7 +4,7 @@ * All Rights Reserved *************************************************/ - export default function() { + export default ['i18n', function(i18n) { return { name: 'configuration_azure_template', showActions: true, @@ -38,7 +38,7 @@ buttons: { reset: { ngClick: 'vm.resetAllConfirm()', - label: 'Reset All', + label: i18n._('Reset All'), class: 'Form-button--left Form-cancelButton' }, cancel: { @@ -51,3 +51,4 @@ } }; } +]; diff --git a/awx/ui/client/src/configuration/auth-form/sub-forms/auth-github-org.form.js b/awx/ui/client/src/configuration/auth-form/sub-forms/auth-github-org.form.js index 6bc58773e3..bd547cf8b1 100644 --- a/awx/ui/client/src/configuration/auth-form/sub-forms/auth-github-org.form.js +++ b/awx/ui/client/src/configuration/auth-form/sub-forms/auth-github-org.form.js @@ -4,7 +4,7 @@ * All Rights Reserved *************************************************/ -export default function() { +export default ['i18n', function(i18n) { return { name: 'configuration_github_org_template', showActions: true, @@ -28,7 +28,7 @@ export default function() { buttons: { reset: { ngClick: 'vm.resetAllConfirm()', - label: 'Reset All', + label: i18n._('Reset All'), class: 'Form-button--left Form-cancelButton' }, cancel: { @@ -41,3 +41,4 @@ export default function() { } }; } +]; diff --git a/awx/ui/client/src/configuration/auth-form/sub-forms/auth-github-team.form.js b/awx/ui/client/src/configuration/auth-form/sub-forms/auth-github-team.form.js index bad0c95627..d43d8c01be 100644 --- a/awx/ui/client/src/configuration/auth-form/sub-forms/auth-github-team.form.js +++ b/awx/ui/client/src/configuration/auth-form/sub-forms/auth-github-team.form.js @@ -4,7 +4,7 @@ * All Rights Reserved *************************************************/ -export default function() { +export default ['i18n', function(i18n) { return { name: 'configuration_github_team_template', showActions: true, @@ -28,7 +28,7 @@ export default function() { buttons: { reset: { ngClick: 'vm.resetAllConfirm()', - label: 'Reset All', + label: i18n._('Reset All'), class: 'Form-button--left Form-cancelButton' }, cancel: { @@ -41,3 +41,4 @@ export default function() { } }; } +]; diff --git a/awx/ui/client/src/configuration/auth-form/sub-forms/auth-github.form.js b/awx/ui/client/src/configuration/auth-form/sub-forms/auth-github.form.js index ee46c53fb7..03af137a7c 100644 --- a/awx/ui/client/src/configuration/auth-form/sub-forms/auth-github.form.js +++ b/awx/ui/client/src/configuration/auth-form/sub-forms/auth-github.form.js @@ -4,7 +4,7 @@ * All Rights Reserved *************************************************/ -export default function() { +export default ['i18n', function(i18n) { return { name: 'configuration_github_template', showActions: true, @@ -24,7 +24,7 @@ export default function() { buttons: { reset: { ngClick: 'vm.resetAllConfirm()', - label: 'Reset All', + label: i18n._('Reset All'), class: 'Form-button--left Form-cancelButton' }, cancel: { @@ -37,3 +37,4 @@ export default function() { } }; } +]; diff --git a/awx/ui/client/src/configuration/auth-form/sub-forms/auth-google-oauth2.form.js b/awx/ui/client/src/configuration/auth-form/sub-forms/auth-google-oauth2.form.js index b00748da55..ac1c23545e 100644 --- a/awx/ui/client/src/configuration/auth-form/sub-forms/auth-google-oauth2.form.js +++ b/awx/ui/client/src/configuration/auth-form/sub-forms/auth-google-oauth2.form.js @@ -4,7 +4,7 @@ * All Rights Reserved *************************************************/ -export default function() { +export default ['i18n', function(i18n) { return { name: 'configuration_google_oauth_template', showActions: true, @@ -36,7 +36,7 @@ export default function() { buttons: { reset: { ngClick: 'vm.resetAllConfirm()', - label: 'Reset All', + label: i18n._('Reset All'), class: 'Form-button--left Form-cancelButton' }, cancel: { @@ -49,3 +49,4 @@ export default function() { } }; } +]; diff --git a/awx/ui/client/src/configuration/auth-form/sub-forms/auth-ldap.form.js b/awx/ui/client/src/configuration/auth-form/sub-forms/auth-ldap.form.js index 2ef6b8b5c4..8d38fea688 100644 --- a/awx/ui/client/src/configuration/auth-form/sub-forms/auth-ldap.form.js +++ b/awx/ui/client/src/configuration/auth-form/sub-forms/auth-ldap.form.js @@ -4,7 +4,7 @@ * All Rights Reserved *************************************************/ -export default function() { +export default ['i18n', function(i18n) { return { // editTitle: 'Authorization Configuration', name: 'configuration_ldap_template', @@ -84,7 +84,7 @@ export default function() { buttons: { reset: { ngClick: 'vm.resetAllConfirm()', - label: 'Reset All', + label: i18n._('Reset All'), class: 'Form-button--left Form-cancelButton' }, cancel: { @@ -97,3 +97,4 @@ export default function() { } }; } +]; diff --git a/awx/ui/client/src/configuration/auth-form/sub-forms/auth-radius.form.js b/awx/ui/client/src/configuration/auth-form/sub-forms/auth-radius.form.js index cd8dc68352..b16fd649dc 100644 --- a/awx/ui/client/src/configuration/auth-form/sub-forms/auth-radius.form.js +++ b/awx/ui/client/src/configuration/auth-form/sub-forms/auth-radius.form.js @@ -4,7 +4,7 @@ * All Rights Reserved *************************************************/ -export default function() { +export default ['i18n', function(i18n) { return { // editTitle: 'Authorization Configuration', name: 'configuration_radius_template', @@ -29,7 +29,7 @@ export default function() { buttons: { reset: { ngClick: 'vm.resetAllConfirm()', - label: 'Reset All', + label: i18n._('Reset All'), class: 'Form-button--left Form-cancelButton' }, cancel: { @@ -42,3 +42,4 @@ export default function() { } }; } +]; diff --git a/awx/ui/client/src/configuration/auth-form/sub-forms/auth-saml.form.js b/awx/ui/client/src/configuration/auth-form/sub-forms/auth-saml.form.js index 462e1373fd..ca2bb50dcb 100644 --- a/awx/ui/client/src/configuration/auth-form/sub-forms/auth-saml.form.js +++ b/awx/ui/client/src/configuration/auth-form/sub-forms/auth-saml.form.js @@ -4,7 +4,7 @@ * All Rights Reserved *************************************************/ -export default function() { +export default ['i18n', function(i18n) { return { name: 'configuration_saml_template', showActions: true, @@ -56,7 +56,7 @@ export default function() { buttons: { reset: { ngClick: 'vm.resetAllConfirm()', - label: 'Reset All', + label: i18n._('Reset All'), class: 'Form-button--left Form-cancelButton' }, cancel: { @@ -69,3 +69,4 @@ export default function() { } }; } +]; diff --git a/awx/ui/client/src/configuration/configuration.controller.js b/awx/ui/client/src/configuration/configuration.controller.js index fd5ddcc017..5bc6ea6415 100644 --- a/awx/ui/client/src/configuration/configuration.controller.js +++ b/awx/ui/client/src/configuration/configuration.controller.js @@ -6,7 +6,7 @@ export default [ '$scope', '$rootScope', '$state', '$stateParams', '$timeout', '$q', 'Alert', 'ClearScope', - 'ConfigurationService', 'ConfigurationUtils', 'CreateDialog', 'CreateSelect2', 'ParseTypeChange', 'ProcessErrors', 'Store', + 'ConfigurationService', 'ConfigurationUtils', 'CreateDialog', 'CreateSelect2', 'i18n', 'ParseTypeChange', 'ProcessErrors', 'Store', 'Wait', 'configDataResolve', //Form definitions 'configurationAzureForm', @@ -22,7 +22,7 @@ export default [ 'ConfigurationUiForm', function( $scope, $rootScope, $state, $stateParams, $timeout, $q, Alert, ClearScope, - ConfigurationService, ConfigurationUtils, CreateDialog, CreateSelect2, ParseTypeChange, ProcessErrors, Store, + ConfigurationService, ConfigurationUtils, CreateDialog, CreateSelect2, i18n, ParseTypeChange, ProcessErrors, Store, Wait, configDataResolve, //Form definitions configurationAzureForm, @@ -153,10 +153,10 @@ export default [ if(!$scope[formTracker.currentFormName()].$dirty) { active(setForm); } else { - var msg = 'You have unsaved changes. Would you like to proceed without saving?'; - var title = 'Warning: Unsaved Changes'; + var msg = i18n._('You have unsaved changes. Would you like to proceed without saving?'); + var title = i18n._('Warning: Unsaved Changes'); var buttons = [{ - label: "Discard changes", + label: i18n._("Discard changes"), "class": "btn Form-cancelButton", "id": "formmodal-cancel-button", onClick: function() { @@ -167,7 +167,7 @@ export default [ active(setForm); } }, { - label: "Save changes", + label: i18n._("Save changes"), onClick: function() { vm.formSave(); $scope[formTracker.currentFormName()].$setPristine(); @@ -206,10 +206,10 @@ export default [ var formCancel = function() { if ($scope[formTracker.currentFormName()].$dirty === true) { - var msg = 'You have unsaved changes. Would you like to proceed without saving?'; - var title = 'Warning: Unsaved Changes'; + var msg = i18n._('You have unsaved changes. Would you like to proceed without saving?'); + var title = i18n._('Warning: Unsaved Changes'); var buttons = [{ - label: "Discard changes", + label: i18n._("Discard changes"), "class": "btn Form-cancelButton", "id": "formmodal-cancel-button", onClick: function() { @@ -217,7 +217,7 @@ export default [ $state.go('setup'); } }, { - label: "Save changes", + label: i18n._("Save changes"), onClick: function() { $scope.formSave(); $('#FormModal-dialog').dialog('close'); @@ -269,8 +269,8 @@ export default [ .catch(function(error) { ProcessErrors($scope, error, status, formDefs[formTracker.getCurrent()], { - hdr: 'Error!', - msg: 'There was an error resetting value. Returned status: ' + error.detail + hdr: i18n._('Error!'), + msg: i18n._('There was an error resetting value. Returned status: ') + error.detail }); }) @@ -347,8 +347,8 @@ export default [ .catch(function(error, status) { ProcessErrors($scope, error, status, formDefs[formTracker.getCurrent()], { - hdr: 'Error!', - msg: 'Failed to save settings. Returned status: ' + status + hdr: i18n._('Error!'), + msg: i18n._('Failed to save settings. Returned status: ') + status }); saveDeferred.reject(error); }) @@ -375,8 +375,8 @@ export default [ $scope[key] = !$scope[key]; ProcessErrors($scope, error, status, formDefs[formTracker.getCurrent()], { - hdr: 'Error!', - msg: 'Failed to save toggle settings. Returned status: ' + error.detail + hdr: i18n._('Error!'), + msg: i18n._('Failed to save toggle settings. Returned status: ') + error.detail }); }) .finally(function() { @@ -394,8 +394,8 @@ export default [ .catch(function(error) { ProcessErrors($scope, error, status, formDefs[formTracker.getCurrent()], { - hdr: 'Error!', - msg: 'There was an error resetting values. Returned status: ' + error.detail + hdr: i18n._('Error!'), + msg: i18n._('There was an error resetting values. Returned status: ') + error.detail }); }) .finally(function() { @@ -405,14 +405,14 @@ export default [ var resetAllConfirm = function() { var buttons = [{ - label: "Cancel", + label: i18n._("Cancel"), "class": "btn btn-default", "id": "formmodal-cancel-button", onClick: function() { $('#FormModal-dialog').dialog('close'); } }, { - label: "Confirm Reset", + label: i18n._("Confirm Reset"), onClick: function() { resetAll(); $('#FormModal-dialog').dialog('close'); @@ -420,8 +420,8 @@ export default [ "class": "btn btn-primary", "id": "formmodal-reset-button" }]; - var msg = 'This will reset all configuration values to their factory defaults. Are you sure you want to proceed?'; - var title = 'Confirm factory reset'; + var msg = i18n._('This will reset all configuration values to their factory defaults. Are you sure you want to proceed?'); + var title = i18n._('Confirm factory reset'); triggerModal(msg, title, buttons); }; diff --git a/awx/ui/client/src/configuration/jobs-form/configuration-jobs.controller.js b/awx/ui/client/src/configuration/jobs-form/configuration-jobs.controller.js index ea2945ab75..726457bc4e 100644 --- a/awx/ui/client/src/configuration/jobs-form/configuration-jobs.controller.js +++ b/awx/ui/client/src/configuration/jobs-form/configuration-jobs.controller.js @@ -13,6 +13,7 @@ export default [ 'ConfigurationUtils', 'CreateSelect2', 'GenerateForm', + 'i18n', function( $scope, $state, @@ -21,7 +22,8 @@ export default [ ConfigurationService, ConfigurationUtils, CreateSelect2, - GenerateForm + GenerateForm, + i18n ) { var jobsVm = this; var generator = GenerateForm; @@ -76,7 +78,7 @@ export default [ CreateSelect2({ element: '#configuration_jobs_template_AD_HOC_COMMANDS', multiple: true, - placeholder: 'Select commands', + placeholder: i18n._('Select commands'), opts: opts }); } diff --git a/awx/ui/client/src/configuration/jobs-form/configuration-jobs.form.js b/awx/ui/client/src/configuration/jobs-form/configuration-jobs.form.js index db84e4233d..05b9d664a7 100644 --- a/awx/ui/client/src/configuration/jobs-form/configuration-jobs.form.js +++ b/awx/ui/client/src/configuration/jobs-form/configuration-jobs.form.js @@ -4,7 +4,7 @@ * All Rights Reserved *************************************************/ - export default function() { + export default ['i18n', function(i18n) { return { showHeader: false, name: 'configuration_jobs_template', @@ -52,7 +52,7 @@ buttons: { reset: { ngClick: 'vm.resetAllConfirm()', - label: 'Reset All', + label: i18n._('Reset All'), class: 'Form-button--left Form-cancelButton' }, cancel: { @@ -64,4 +64,4 @@ } } }; - } + }]; diff --git a/awx/ui/client/src/configuration/system-form/configuration-system.form.js b/awx/ui/client/src/configuration/system-form/configuration-system.form.js index d0e4cc9d2b..47a4ceac0b 100644 --- a/awx/ui/client/src/configuration/system-form/configuration-system.form.js +++ b/awx/ui/client/src/configuration/system-form/configuration-system.form.js @@ -4,7 +4,7 @@ * All Rights Reserved *************************************************/ -export default function() { +export default ['i18n', function(i18n) { return { showHeader: false, name: 'configuration_system_template', @@ -38,7 +38,7 @@ export default function() { buttons: { reset: { ngClick: 'vm.resetAllConfirm()', - label: 'Reset All', + label: i18n._('Reset All'), class: 'Form-button--left Form-cancelButton' }, cancel: { @@ -51,3 +51,4 @@ export default function() { } }; } +]; diff --git a/awx/ui/client/src/configuration/ui-form/configuration-ui.controller.js b/awx/ui/client/src/configuration/ui-form/configuration-ui.controller.js index 103c9b8040..f9f8f4eaad 100644 --- a/awx/ui/client/src/configuration/ui-form/configuration-ui.controller.js +++ b/awx/ui/client/src/configuration/ui-form/configuration-ui.controller.js @@ -12,6 +12,7 @@ 'ConfigurationService', 'CreateSelect2', 'GenerateForm', + 'i18n', function( $scope, $state, @@ -19,7 +20,8 @@ ConfigurationUiForm, ConfigurationService, CreateSelect2, - GenerateForm + GenerateForm, + i18n ) { var uiVm = this; var generator = GenerateForm; @@ -71,7 +73,7 @@ CreateSelect2({ element: '#configuration_ui_template_PENDO_TRACKING_STATE', multiple: false, - placeholder: 'Select commands', + placeholder: i18n._('Select commands'), opts: [{ id: $scope.$parent.PENDO_TRACKING_STATE, text: $scope.$parent.PENDO_TRACKING_STATE diff --git a/awx/ui/client/src/configuration/ui-form/configuration-ui.form.js b/awx/ui/client/src/configuration/ui-form/configuration-ui.form.js index eb61885d95..0ef2cb44ff 100644 --- a/awx/ui/client/src/configuration/ui-form/configuration-ui.form.js +++ b/awx/ui/client/src/configuration/ui-form/configuration-ui.form.js @@ -4,7 +4,7 @@ * All Rights Reserved *************************************************/ -export default function() { +export default ['i18n', function(i18n) { return { showHeader: false, name: 'configuration_ui_template', @@ -32,7 +32,7 @@ export default function() { buttons: { reset: { ngClick: 'vm.resetAllConfirm()', - label: 'Reset All', + label: i18n._('Reset All'), class: 'Form-button--left Form-cancelButton' }, cancel: { @@ -45,3 +45,4 @@ export default function() { } }; } +];