Added i18n parsing to strings

This commit is contained in:
Ken Hoes 2016-12-07 15:26:12 -05:00
parent ffe6ec97ef
commit 9c95a2c778
15 changed files with 78 additions and 62 deletions

View File

@ -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 <strong>without</strong> saving?';
var title = 'Warning: Unsaved Changes';
var msg = i18n._('You have unsaved changes. Would you like to proceed <strong>without</strong> 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

View File

@ -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 @@
}
};
}
];

View File

@ -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() {
}
};
}
];

View File

@ -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() {
}
};
}
];

View File

@ -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() {
}
};
}
];

View File

@ -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() {
}
};
}
];

View File

@ -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() {
}
};
}
];

View File

@ -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() {
}
};
}
];

View File

@ -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() {
}
};
}
];

View File

@ -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 <strong>without</strong> saving?';
var title = 'Warning: Unsaved Changes';
var msg = i18n._('You have unsaved changes. Would you like to proceed <strong>without</strong> 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 <strong>without</strong> saving?';
var title = 'Warning: Unsaved Changes';
var msg = i18n._('You have unsaved changes. Would you like to proceed <strong>without</strong> 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);
};

View File

@ -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
});
}

View File

@ -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 @@
}
}
};
}
}];

View File

@ -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() {
}
};
}
];

View File

@ -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

View File

@ -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() {
}
};
}
];