Enable message i18n with angular-gettext

Signed-off-by: Takao Fujiwara <tfujiwar@redhat.com>
This commit is contained in:
Takao Fujiwara
2016-10-07 18:43:33 +09:00
committed by jaredevantabor
parent 088e9c0291
commit 40b94a38a8
60 changed files with 3116 additions and 805 deletions

View File

@@ -12,14 +12,15 @@
export default
angular.module('CredentialFormDefinition', [])
.value('CredentialForm', {
.factory('CredentialForm', ['i18n', function(i18n) {
return {
addTitle: 'Create Credential', //Legend in add mode
addTitle: i18n._('Create Credential'), //Legend in add mode
editTitle: '{{ name }}', //Legend in edit mode
name: 'credential',
forceListeners: true,
subFormTitles: {
credentialSubForm: 'Type Details',
credentialSubForm: i18n._('Type Details'),
},
actions: {
@@ -28,7 +29,7 @@ export default
fields: {
name: {
label: 'Name',
label: i18n._('Name'),
type: 'text',
addRequired: true,
editRequired: true,
@@ -36,7 +37,7 @@ export default
ngDisabled: '!(credential_obj.summary_fields.user_capabilities.edit || canAdd)'
},
description: {
label: 'Description',
label: i18n._('Description'),
type: 'text',
addRequired: false,
editRequired: false,
@@ -46,26 +47,26 @@ export default
addRequired: false,
editRequired: false,
ngShow: 'canShareCredential',
label: 'Organization',
label: i18n._('Organization'),
type: 'lookup',
sourceModel: 'organization',
sourceField: 'name',
ngClick: 'lookUpOrganization()',
awPopOver: "<p>If no organization is given, the credential can only be used by the user that creates the credential. Organization admins and system administrators can assign an organization so that roles for the credential can be assigned to users and teams in that organization.</p>",
dataTitle: 'Organization ',
awPopOver: i18n._("<p>If no organization is given, the credential can only be used by the user that creates the credential. Organization admins and system administrators can assign an organization so that roles for the credential can be assigned to users and teams in that organization.</p>"),
dataTitle: i18n._('Organization') + ' ',
dataPlacement: 'bottom',
dataContainer: "body",
ngDisabled: '!(credential_obj.summary_fields.user_capabilities.edit || canAdd)'
},
kind: {
label: 'Type',
label: i18n._('Type'),
excludeModal: true,
type: 'select',
ngOptions: 'kind.label for kind in credential_kind_options track by kind.value', // select as label for value in array 'kind.label for kind in credential_kind_options',
ngChange: 'kindChange()',
addRequired: true,
editRequired: true,
awPopOver:'<dl>\n' +
awPopOver: i18n._('<dl>\n' +
'<dt>Machine</dt>\n' +
'<dd>Authentication for remote machine access. This can include SSH keys, usernames, passwords, ' +
'and sudo information. Machine credentials are used when submitting jobs to run playbooks against ' +
@@ -82,15 +83,15 @@ export default
'<dd>Usernames, passwords, and access keys for authenticating to the specified cloud or infrastructure ' +
'provider. These are used for dynamic inventory sources and for cloud provisioning and deployment ' +
'in playbook runs.</dd>\n' +
'</dl>\n',
dataTitle: 'Type',
'</dl>\n'),
dataTitle: i18n._('Type'),
dataPlacement: 'right',
dataContainer: "body",
hasSubForm: true,
ngDisabled: '!(credential_obj.summary_fields.user_capabilities.edit || canAdd)'
},
access_key: {
label: 'Access Key',
label: i18n._('Access Key'),
type: 'text',
ngShow: "kind.value == 'aws'",
awRequiredWhen: {
@@ -103,7 +104,7 @@ export default
ngDisabled: '!(credential_obj.summary_fields.user_capabilities.edit || canAdd)'
},
secret_key: {
label: 'Secret Key',
label: i18n._('Secret Key'),
type: 'sensitive',
ngShow: "kind.value == 'aws'",
ngDisabled: "secret_key_ask || !(credential_obj.summary_fields.user_capabilities.edit || canAdd)",
@@ -118,14 +119,14 @@ export default
subForm: 'credentialSubForm'
},
security_token: {
label: 'STS Token',
label: i18n._('STS Token'),
type: 'sensitive',
ngShow: "kind.value == 'aws'",
autocomplete: false,
apiField: 'security_token',
awPopOver: "<div>Security Token Service (STS) is a web service that enables you to request temporary, limited-privilege credentials for AWS Identity and Access Management (IAM) users.</div><div style='padding-top: 10px'>To learn more about the IAM STS Token, refer to the <a href='http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp.html' target='_blank'>Amazon documentation</a>.</div>",
awPopOver: i18n._("<div>Security Token Service (STS) is a web service that enables you to request temporary, limited-privilege credentials for AWS Identity and Access Management (IAM) users.</div><div style='padding-top: 10px'>To learn more about the IAM STS Token, refer to the <a href='http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp.html' target='_blank'>Amazon documentation</a>.</div>"),
hasShowInputButton: true,
dataTitle: 'STS Token',
dataTitle: i18n._('STS Token'),
dataPlacement: 'right',
dataContainer: "body",
subForm: 'credentialSubForm',
@@ -136,8 +137,8 @@ export default
type: 'text',
ngShow: "kind.value == 'vmware' || kind.value == 'openstack' || kind.value === 'satellite6' || kind.value === 'cloudforms'",
awPopOverWatch: "hostPopOver",
awPopOver: "set in helpers/credentials",
dataTitle: 'Host',
awPopOver: i18n._("set in helpers/credentials"),
dataTitle: i18n._('Host'),
dataPlacement: 'right',
dataContainer: "body",
autocomplete: false,
@@ -149,7 +150,7 @@ export default
ngDisabled: '!(credential_obj.summary_fields.user_capabilities.edit || canAdd)'
},
"subscription": {
label: "Subscription ID",
label: i18n._("Subscription ID"),
type: 'text',
ngShow: "kind.value == 'azure' || kind.value == 'azure_rm'",
awRequiredWhen: {
@@ -159,8 +160,8 @@ export default
addRequired: false,
editRequired: false,
autocomplete: false,
awPopOver: '<p>Subscription ID is an Azure construct, which is mapped to a username.</p>',
dataTitle: 'Subscription ID',
awPopOver: i18n._('<p>Subscription ID is an Azure construct, which is mapped to a username.</p>'),
dataTitle: i18n._('Subscription ID'),
dataPlacement: 'right',
dataContainer: "body",
subForm: 'credentialSubForm',
@@ -188,15 +189,15 @@ export default
init: false
},
autocomplete: false,
awPopOver: '<p>The email address assigned to the Google Compute Engine <b><i>service account.</b></i></p>',
dataTitle: 'Email',
awPopOver: i18n._('<p>The email address assigned to the Google Compute Engine <b><i>service account.</b></i></p>'),
dataTitle: i18n._('Email'),
dataPlacement: 'right',
dataContainer: "body",
subForm: 'credentialSubForm',
ngDisabled: '!(credential_obj.summary_fields.user_capabilities.edit || canAdd)'
},
"api_key": {
label: 'API Key',
label: i18n._('API Key'),
type: 'sensitive',
ngShow: "kind.value == 'rax'",
awRequiredWhen: {
@@ -224,7 +225,7 @@ export default
ngDisabled: '!(credential_obj.summary_fields.user_capabilities.edit || canAdd)'
},
"ssh_password": {
label: 'Password',
label: i18n._('Password'),
type: 'sensitive',
ngShow: "kind.value == 'ssh'",
ngDisabled: "ssh_password_ask || !(credential_obj.summary_fields.user_capabilities.edit || canAdd)",
@@ -232,7 +233,7 @@ export default
editRequired: false,
subCheckbox: {
variable: 'ssh_password_ask',
text: 'Ask at runtime?',
text: i18n._('Ask at runtime?'),
ngChange: 'ask(\'ssh_password\', \'undefined\')'
},
hasShowInputButton: true,
@@ -254,16 +255,16 @@ export default
editRequired: false,
awDropFile: true,
rows: 10,
awPopOver: "SSH key description",
awPopOver: i18n._("SSH key description"),
awPopOverWatch: "key_description",
dataTitle: 'Private Key',
dataTitle: i18n._('Private Key'),
dataPlacement: 'right',
dataContainer: "body",
subForm: "credentialSubForm",
ngDisabled: '!(credential_obj.summary_fields.user_capabilities.edit || canAdd)'
},
"ssh_key_unlock": {
label: 'Private Key Passphrase',
label: i18n._('Private Key Passphrase'),
type: 'sensitive',
ngShow: "kind.value == 'ssh' || kind.value == 'scm'",
addRequired: false,
@@ -272,7 +273,7 @@ export default
subCheckbox: {
variable: 'ssh_key_unlock_ask',
ngShow: "kind.value == 'ssh'",
text: 'Ask at runtime?',
text: i18n._('Ask at runtime?'),
ngChange: 'ask(\'ssh_key_unlock\', \'undefined\')',
ngDisabled: "keyEntered === false"
},
@@ -280,15 +281,15 @@ export default
subForm: 'credentialSubForm'
},
"become_method": {
label: "Privilege Escalation",
label: i18n._("Privilege Escalation"),
// hintText: "If your playbooks use privilege escalation (\"sudo: true\", \"su: true\", etc), you can specify the username to become, and the password to use here.",
type: 'select',
ngShow: "kind.value == 'ssh'",
dataTitle: 'Privilege Escalation',
dataTitle: i18n._('Privilege Escalation'),
ngOptions: 'become.label for become in become_options track by become.value',
awPopOver: "<p>Specify a method for 'become' operations. " +
awPopOver: i18n._("<p>Specify a method for 'become' operations. " +
"This is equivalent to specifying the <code>--become-method=BECOME_METHOD</code> parameter, where <code>BECOME_METHOD</code> could be "+
"<code>sudo | su | pbrun | pfexec | runas</code> <br>(defaults to <code>sudo</code>)</p>",
"<code>sudo | su | pbrun | pfexec | runas</code> <br>(defaults to <code>sudo</code>)</p>"),
dataPlacement: 'right',
dataContainer: "body",
subForm: 'credentialSubForm',
@@ -313,7 +314,7 @@ export default
editRequired: false,
subCheckbox: {
variable: 'become_password_ask',
text: 'Ask at runtime?',
text: i18n._('Ask at runtime?'),
ngChange: 'ask(\'become_password\', \'undefined\')'
},
hasShowInputButton: true,
@@ -322,7 +323,7 @@ export default
},
client:{
type: 'text',
label: 'Client ID',
label: i18n._('Client ID'),
subForm: 'credentialSubForm',
ngShow: "kind.value === 'azure_rm'",
ngDisabled: '!(credential_obj.summary_fields.user_capabilities.edit || canAdd)'
@@ -331,20 +332,20 @@ export default
type: 'sensitive',
hasShowInputButton: true,
autocomplete: false,
label: 'Client Secret',
label: i18n._('Client Secret'),
subForm: 'credentialSubForm',
ngShow: "kind.value === 'azure_rm'",
ngDisabled: '!(credential_obj.summary_fields.user_capabilities.edit || canAdd)'
},
tenant: {
type: 'text',
label: 'Tenant ID',
label: i18n._('Tenant ID'),
subForm: 'credentialSubForm',
ngShow: "kind.value === 'azure_rm'",
ngDisabled: '!(credential_obj.summary_fields.user_capabilities.edit || canAdd)'
},
authorize: {
label: 'Authorize',
label: i18n._('Authorize'),
type: 'checkbox',
ngChange: "toggleCallback('host_config_key')",
subForm: 'credentialSubForm',
@@ -352,7 +353,7 @@ export default
ngDisabled: '!(credential_obj.summary_fields.user_capabilities.edit || canAdd)'
},
authorize_password: {
label: 'Authorize Password',
label: i18n._('Authorize Password'),
type: 'sensitive',
hasShowInputButton: true,
autocomplete: false,
@@ -365,8 +366,8 @@ export default
type: 'text',
ngShow: "kind.value == 'gce' || kind.value == 'openstack'",
awPopOverWatch: "projectPopOver",
awPopOver: "set in helpers/credentials",
dataTitle: 'Project Name',
awPopOver: i18n._("set in helpers/credentials"),
dataTitle: i18n._('Project Name'),
dataPlacement: 'right',
dataContainer: "body",
addRequired: false,
@@ -382,12 +383,12 @@ export default
labelBind: 'domainLabel',
type: 'text',
ngShow: "kind.value == 'openstack'",
awPopOver: "<p>OpenStack domains define administrative " +
awPopOver: i18n._("<p>OpenStack domains define administrative " +
"boundaries. It is only needed for Keystone v3 authentication URLs. " +
"Common scenarios include:<ul><li><b>v2 URLs</b> - leave blank</li>" +
"<li><b>v3 default</b> - set to 'default'</br></li>" +
"<li><b>v3 multi-domain</b> - your domain name</p></li></ul></p>",
dataTitle: 'Domain Name',
"<li><b>v3 multi-domain</b> - your domain name</p></li></ul></p>"),
dataTitle: i18n._('Domain Name'),
dataPlacement: 'right',
dataContainer: "body",
addRequired: false,
@@ -396,7 +397,7 @@ export default
ngDisabled: '!(credential_obj.summary_fields.user_capabilities.edit || canAdd)'
},
"vault_password": {
label: "Vault Password",
label: i18n._("Vault Password"),
type: 'sensitive',
ngShow: "kind.value == 'ssh'",
ngDisabled: "vault_password_ask || !(credential_obj.summary_fields.user_capabilities.edit || canAdd)",
@@ -404,7 +405,7 @@ export default
editRequired: false,
subCheckbox: {
variable: 'vault_password_ask',
text: 'Ask at runtime?',
text: i18n._('Ask at runtime?'),
ngChange: 'ask(\'vault_password\', \'undefined\')'
},
hasShowInputButton: true,
@@ -438,7 +439,7 @@ export default
dataPlacement: 'top',
basePath: 'credentials/:id/access_list/',
type: 'collection',
title: 'Permissions',
title: i18n._('Permissions'),
iterator: 'permission',
index: false,
open: false,
@@ -447,9 +448,9 @@ export default
add: {
ngClick: "addPermission",
label: 'Add',
awToolTip: 'Add a permission',
awToolTip: i18n._('Add a permission'),
actionClass: 'btn List-buttonSubmit',
buttonContent: '&#43; ADD',
buttonContent: i18n._('&#43; ADD'),
ngShow: '(credential_obj.summary_fields.user_capabilities.edit || canAdd)'
}
},
@@ -457,19 +458,19 @@ export default
fields: {
username: {
key: true,
label: 'User',
label: i18n._('User'),
linkBase: 'users',
class: 'col-lg-3 col-md-3 col-sm-3 col-xs-4'
},
role: {
label: 'Role',
label: i18n._('Role'),
type: 'role',
noSort: true,
class: 'col-lg-4 col-md-4 col-sm-4 col-xs-4',
searchable: false
},
team_roles: {
label: 'Team Roles',
label: i18n._('Team Roles'),
type: 'team_roles',
noSort: true,
class: 'col-lg-5 col-md-5 col-sm-5 col-xs-4',
@@ -487,4 +488,4 @@ export default
}
};
}
});
};}]);