diff --git a/horizon/static/framework/conf/resource-type-registry.service.js b/horizon/static/framework/conf/resource-type-registry.service.js index 07873ea6b9..2710444dd2 100644 --- a/horizon/static/framework/conf/resource-type-registry.service.js +++ b/horizon/static/framework/conf/resource-type-registry.service.js @@ -570,12 +570,12 @@ * * The type's "names" property holds an array of the labels to be used * here which are passed to ngettext, so for example names could be - * [gettext('Image'), gettext('Images')] + * ['Image', 'Images'] * * @example ``` var resourceType = getResourceType('thing'); - resourceType.names = [gettext('Thing'), gettext('Things')]; + resourceType.names = ['Thing', 'Things']; var singleName = resourceType.getName(1); // returns singular ``` */ @@ -589,19 +589,22 @@ * @ngdoc function * @name setNames * @description - * Takes in the singular/plural names used for display. + * Takes in the untranslated singular/plural names used for display. + * The "translated" parameter is to mark the strings for translation. * @example ``` var resourceType = getResourceType('thing') - .setNames(gettext('Thing'), gettext('Things')); + .setNames('Thing', 'Things', ngettext('Thing', 'Things', 1)); }); ``` */ - function setNames(singular, plural) { + /* eslint-disable no-unused-vars */ + function setNames(singular, plural, translated) { names = [singular, plural]; return self; } + /* eslint-enable no-unused-vars */ /** * @ngdoc function diff --git a/openstack_dashboard/dashboards/identity/static/dashboard/identity/domains/domains.module.js b/openstack_dashboard/dashboards/identity/static/dashboard/identity/domains/domains.module.js index 163b7d1721..6f902b7637 100644 --- a/openstack_dashboard/dashboards/identity/static/dashboard/identity/domains/domains.module.js +++ b/openstack_dashboard/dashboards/identity/static/dashboard/identity/domains/domains.module.js @@ -44,7 +44,7 @@ function run(registry, domainService, basePath, domainResourceType) { registry.getResourceType(domainResourceType) - .setNames(gettext('Domain'), gettext('Domains')) + .setNames('Domain', 'Domains', ngettext('Domain', 'Domains', 1)) .setSummaryTemplateUrl(basePath + 'details/drawer.html') .setDefaultIndexUrl('/identity/domains/') .setProperties(domainProperties()) diff --git a/openstack_dashboard/dashboards/identity/static/dashboard/identity/groups/groups.module.js b/openstack_dashboard/dashboards/identity/static/dashboard/identity/groups/groups.module.js index cb58afd1e2..fe54f7a372 100644 --- a/openstack_dashboard/dashboards/identity/static/dashboard/identity/groups/groups.module.js +++ b/openstack_dashboard/dashboards/identity/static/dashboard/identity/groups/groups.module.js @@ -43,7 +43,7 @@ function run(registry, keystone, basePath, groupResourceType) { registry.getResourceType(groupResourceType) - .setNames(gettext('Group'), gettext('Groups')) + .setNames('Group', 'Groups', ngettext('Group', 'Groups', 1)) .setProperties(groupProperties()) .setListFunction(listFunction) .tableColumns diff --git a/openstack_dashboard/dashboards/identity/static/dashboard/identity/roles/roles.module.js b/openstack_dashboard/dashboards/identity/static/dashboard/identity/roles/roles.module.js index ce08349e20..5252c06715 100644 --- a/openstack_dashboard/dashboards/identity/static/dashboard/identity/roles/roles.module.js +++ b/openstack_dashboard/dashboards/identity/static/dashboard/identity/roles/roles.module.js @@ -42,7 +42,7 @@ function run(registry, keystone, roleResourceType) { registry.getResourceType(roleResourceType) - .setNames(gettext('Role'), gettext('Roles')) + .setNames('Role', 'Roles', ngettext('Role', 'Roles', 1)) .setProperties(roleProperties()) .setListFunction(listFunction) .tableColumns diff --git a/openstack_dashboard/dashboards/identity/static/dashboard/identity/users/users.module.js b/openstack_dashboard/dashboards/identity/static/dashboard/identity/users/users.module.js index 01d5d06fe1..61d552abc4 100644 --- a/openstack_dashboard/dashboards/identity/static/dashboard/identity/users/users.module.js +++ b/openstack_dashboard/dashboards/identity/static/dashboard/identity/users/users.module.js @@ -46,7 +46,7 @@ function run(registry, basePath, userResourceType, usersService) { registry.getResourceType(userResourceType) - .setNames(gettext('User'), gettext('Users')) + .setNames('User', 'Users', ngettext('User', 'Users', 1)) .setSummaryTemplateUrl(basePath + 'details/drawer.html') .setDefaultIndexUrl('/identity/users/') .setProperties(userProperties()) diff --git a/openstack_dashboard/dashboards/project/static/dashboard/project/containers/containers.module.js b/openstack_dashboard/dashboards/project/static/dashboard/project/containers/containers.module.js index 833a91a8a4..db389d2e0f 100644 --- a/openstack_dashboard/dashboards/project/static/dashboard/project/containers/containers.module.js +++ b/openstack_dashboard/dashboards/project/static/dashboard/project/containers/containers.module.js @@ -83,12 +83,15 @@ function run(accountResCode, containerResCode, objectResCode, registryService) { registryService.getResourceType(accountResCode) - .setNames(gettext('Swift Account'), gettext('Swift Accounts')); + .setNames('Swift Account', 'Swift Accounts', + ngettext('Swift Account', 'Swift Accounts', 1)); registryService.getResourceType(containerResCode) - .setNames(gettext('Swift Container'), gettext('Swift Containers')); + .setNames('Swift Container', 'Swift Containers', + ngettext('Swift Container', 'Swift Containers', 1)); var objectResourceType = registryService.getResourceType(objectResCode); - objectResourceType.setNames(gettext('Object'), gettext('Objects')) + objectResourceType.setNames('Object', 'Objects', + ngettext('Object', 'Objects', 1)) .setProperty('name', {label: gettext('Name')}) .setProperty('size', { label: gettext('Size')}); diff --git a/openstack_dashboard/static/app/core/flavors/flavors.module.js b/openstack_dashboard/static/app/core/flavors/flavors.module.js index d89ead72d5..2866b736cb 100644 --- a/openstack_dashboard/static/app/core/flavors/flavors.module.js +++ b/openstack_dashboard/static/app/core/flavors/flavors.module.js @@ -46,7 +46,7 @@ function run(registry, gettext, basePath, flavorsService, flavorResourceType) { registry.getResourceType(flavorResourceType) - .setNames(gettext('Flavor'), gettext('Flavors')) + .setNames('Flavor', 'Flavors', ngettext('Flavor', 'Flavors', 1)) .setSummaryTemplateUrl(basePath + 'summary.html') .setProperties(flavorProperties()) .setListFunction(flavorsService.getFlavorsPromise) diff --git a/openstack_dashboard/static/app/core/images/images.module.js b/openstack_dashboard/static/app/core/images/images.module.js index 50d5e8911a..34330f5c8e 100644 --- a/openstack_dashboard/static/app/core/images/images.module.js +++ b/openstack_dashboard/static/app/core/images/images.module.js @@ -71,7 +71,7 @@ $memoize, keystone) { registry.getResourceType(imageResourceType) - .setNames(gettext('Image'), gettext('Images')) + .setNames('Image', 'Images', ngettext('Image', 'Images', 1)) .setSummaryTemplateUrl(basePath + 'details/drawer.html') .setDefaultIndexUrl('/project/images/') .setItemInTransitionFunction(imagesService.isInTransition) diff --git a/openstack_dashboard/static/app/core/keypairs/keypairs.module.js b/openstack_dashboard/static/app/core/keypairs/keypairs.module.js index 1f9abd08d4..f0782b2305 100644 --- a/openstack_dashboard/static/app/core/keypairs/keypairs.module.js +++ b/openstack_dashboard/static/app/core/keypairs/keypairs.module.js @@ -45,7 +45,7 @@ function run(registry, nova, basePath, resourceType, keypairsService) { registry.getResourceType(resourceType) - .setNames(gettext('Key Pair'), gettext('Key Pairs')) + .setNames('Key Pair', 'Key Pairs', ngettext('Key Pair', 'Key Pairs', 1)) // for detail summary view on table row. .setSummaryTemplateUrl(basePath + 'details/drawer.html') .setDefaultIndexUrl('/project/key_pairs/') diff --git a/openstack_dashboard/static/app/core/network_qos/qos.module.js b/openstack_dashboard/static/app/core/network_qos/qos.module.js index a66699f0fd..c5e0157fe0 100644 --- a/openstack_dashboard/static/app/core/network_qos/qos.module.js +++ b/openstack_dashboard/static/app/core/network_qos/qos.module.js @@ -49,7 +49,8 @@ qosService, qosResourceType) { registry.getResourceType(qosResourceType) - .setNames(gettext('QoS Policy'), gettext('QoS Policies')) + .setNames('QoS Policy', 'QoS Policies', + ngettext('QoS Policy', 'QoS Policies', 1)) .setSummaryTemplateUrl(basePath + 'details/drawer.html') .setDefaultIndexUrl('/project/network_qos/') .setProperties(qosProperties(qosService)) diff --git a/openstack_dashboard/static/app/core/server_groups/server-groups.module.js b/openstack_dashboard/static/app/core/server_groups/server-groups.module.js index 6499056f6f..ebd72381a4 100644 --- a/openstack_dashboard/static/app/core/server_groups/server-groups.module.js +++ b/openstack_dashboard/static/app/core/server_groups/server-groups.module.js @@ -44,7 +44,8 @@ serverGroupsService, registry) { registry.getResourceType(serverGroupResourceType) - .setNames(gettext('Server Group'), gettext('Server Groups')) + .setNames('Server Group', 'Server Groups', + ngettext('Server Group', 'Server Groups', 1)) .setProperties(serverGroupProperties()) .setListFunction(serverGroupsService.getServerGroupsPromise) .tableColumns diff --git a/openstack_dashboard/static/app/core/trunks/trunks.module.js b/openstack_dashboard/static/app/core/trunks/trunks.module.js index 770ad42af8..0f2993019e 100644 --- a/openstack_dashboard/static/app/core/trunks/trunks.module.js +++ b/openstack_dashboard/static/app/core/trunks/trunks.module.js @@ -52,7 +52,7 @@ trunksService, trunkResourceType) { registry.getResourceType(trunkResourceType) - .setNames(gettext('Trunk'), gettext('Trunks')) + .setNames('Trunk', 'Trunks', ngettext('Trunk', 'Trunks', 1)) .setSummaryTemplateUrl(basePath + 'summary.html') .setDefaultIndexUrl('/project/trunks/') .setProperties(trunkProperties()) diff --git a/openstack_dashboard/static/app/resources/resources.module.js b/openstack_dashboard/static/app/resources/resources.module.js index 4ab8d583c5..195500ae60 100644 --- a/openstack_dashboard/static/app/resources/resources.module.js +++ b/openstack_dashboard/static/app/resources/resources.module.js @@ -41,52 +41,66 @@ // fleshed out there's no reason to pollute the directory/file structure. // As a model, the Images registration happens in the images module. registry.getResourceType('OS::Glance::Metadef') - .setNames(gettext('Metadata Definition'), gettext('Metadata Definitions')); + .setNames('Metadata Definition', 'Metadata Definitions', + ngettext('Metadata Definition', 'Metadata Definitions', 1)); registry.getResourceType('OS::Nova::Server') - .setNames(gettext('Instance'), gettext('Instances')); + .setNames('Instance', 'Instances', ngettext('Instance', 'Instances', 1)); registry.getResourceType('OS::Nova::Flavor') - .setNames(gettext('Flavor'), gettext('Flavors')); + .setNames('Flavor', 'Flavors', ngettext('Flavor', 'Flavors', 1)); registry.getResourceType('OS::Nova::Hypervisor') - .setNames(gettext('Hypervisor'), gettext('Hypervisors')); + .setNames('Hypervisor', 'Hypervisors', + ngettext('Hypervisor', 'Hypervisors', 1)); registry.getResourceType('OS::Nova::Keypair') - .setNames(gettext('Key Pair'), gettext('Key Pairs')); + .setNames('Key Pair', 'Key Pairs', ngettext('Key Pair', 'Key Pairs', 1)); registry.getResourceType('OS::Designate::Zone') - .setNames(gettext('DNS Domain'), gettext('DNS Domains')); + .setNames('DNS Domain', 'DNS Domains', + ngettext('DNS Domain', 'DNS Domains', 1)); registry.getResourceType('OS::Designate::RecordSet') - .setNames(gettext('DNS Record'), gettext('DNS Records')); + .setNames('DNS Record', 'DNS Records', + ngettext('DNS Record', 'DNS Records', 1)); registry.getResourceType('OS::Cinder::Backup') - .setNames(gettext('Volume Backup'), gettext('Volume Backups')); + .setNames('Volume Backup', 'Volume Backups', + ngettext('Volume Backup', 'Volume Backups', 1)); registry.getResourceType('OS::Cinder::Snapshot') - .setNames(gettext('Volume Snapshot'), gettext('Volume Snapshots')); + .setNames('Volume Snapshot', 'Volume Snapshots', + ngettext('Volume Snapshot', 'Volume Snapshots', 1)); registry.getResourceType('OS::Cinder::Volume') - .setNames(gettext('Volume'), gettext('Volumes')); + .setNames('Volume', 'Volumes', ngettext('Volume', 'Volumes', 1)); registry.getResourceType('OS::Neutron::HealthMonitor') - .setNames(gettext('Network Health Monitor'), gettext('Network Health Monitors')); + .setNames('Network Health Monitor', 'Network Health Monitors', + ngettext('Network Health Monitor', 'Network Health Monitors', 1)); registry.getResourceType('OS::Neutron::Net') - .setNames(gettext('Network'), gettext('Networks')); + .setNames('Network', 'Networks', ngettext('Network', 'Networks', 1)); registry.getResourceType('OS::Neutron::Pool') - .setNames(gettext('Load Balancer Pool'), gettext('Load Balancer Pools')); + .setNames('Load Balancer Pool', 'Load Balancer Pools', + ngettext('Load Balancer Pool', 'Load Balancer Pools', 1)); registry.getResourceType('OS::Neutron::PoolMember') - .setNames(gettext('Load Balancer Pool Member'), gettext('Load Balancer Pool Members')); + .setNames('Load Balancer Pool Member', 'Load Balancer Pool Members', + ngettext('Load Balancer Pool Member', 'Load Balancer Pool Members', 1)); registry.getResourceType('OS::Neutron::Port') - .setNames(gettext('Network Port'), gettext('Network Ports')); + .setNames('Network Port', 'Network Ports', + ngettext('Network Port', 'Network Ports', 1)); registry.getResourceType('OS::Neutron::Router') - .setNames(gettext('Network Router'), gettext('Network Routers')); + .setNames('Network Router', 'Network Routers', + ngettext('Network Router', 'Network Routers', 1)); registry.getResourceType('OS::Neutron::Subnet') - .setNames(gettext('Network Subnet'), gettext('Network Subnets')); + .setNames('Network Subnet', 'Network Subnets', + ngettext('Network Subnet', 'Network Subnets', 1)); registry.getResourceType('OS::Neutron::FloatingIP') - .setNames(gettext('Floating IP'), gettext('Floating IPs')); + .setNames('Floating IP', 'Floating IPs', + ngettext('Floating IP', 'Floating IPs', 1)); registry.getResourceType('OS::Neutron::SecurityGroup') - .setNames(gettext('Security Group'), gettext('Security Groups')); + .setNames('Security Group', 'Security Groups', + ngettext('Security Group', 'Security Groups', 1)); registry.getResourceType('OS::Neutron::Trunk') - .setNames(gettext('Trunk'), gettext('Trunks')); + .setNames('Trunk', 'Trunks', ngettext('Trunk', 'Trunks', 1)); registry.getResourceType('OS::Keystone::User') - .setNames(gettext('User'), gettext('Users')); + .setNames('User', 'Users', ngettext('User', 'Users', 1)); registry.getResourceType('OS::Keystone::Group') - .setNames(gettext('Group'), gettext('Groups')); + .setNames('Group', 'Groups', ngettext('Group', 'Groups', 1)); registry.getResourceType('OS::Keystone::Project') - .setNames(gettext('Project'), gettext('Projects')); + .setNames('Project', 'Projects', ngettext('Project', 'Projects', 1)); registry.getResourceType('OS::Keystone::Role') - .setNames(gettext('Role'), gettext('Roles')); + .setNames('Role', 'Roles', ngettext('Role', 'Roles', 1)); } })();