Browse Source

Merge "Fix use of ngettext in registry getName" into stable/train

changes/81/750581/1
Zuul 3 weeks ago
committed by Gerrit Code Review
parent
commit
9efa305e09
13 changed files with 64 additions and 42 deletions
  1. +8
    -5
      horizon/static/framework/conf/resource-type-registry.service.js
  2. +1
    -1
      openstack_dashboard/dashboards/identity/static/dashboard/identity/domains/domains.module.js
  3. +1
    -1
      openstack_dashboard/dashboards/identity/static/dashboard/identity/groups/groups.module.js
  4. +1
    -1
      openstack_dashboard/dashboards/identity/static/dashboard/identity/roles/roles.module.js
  5. +1
    -1
      openstack_dashboard/dashboards/identity/static/dashboard/identity/users/users.module.js
  6. +6
    -3
      openstack_dashboard/dashboards/project/static/dashboard/project/containers/containers.module.js
  7. +1
    -1
      openstack_dashboard/static/app/core/flavors/flavors.module.js
  8. +1
    -1
      openstack_dashboard/static/app/core/images/images.module.js
  9. +1
    -1
      openstack_dashboard/static/app/core/keypairs/keypairs.module.js
  10. +2
    -1
      openstack_dashboard/static/app/core/network_qos/qos.module.js
  11. +2
    -1
      openstack_dashboard/static/app/core/server_groups/server-groups.module.js
  12. +1
    -1
      openstack_dashboard/static/app/core/trunks/trunks.module.js
  13. +38
    -24
      openstack_dashboard/static/app/resources/resources.module.js

+ 8
- 5
horizon/static/framework/conf/resource-type-registry.service.js View File

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


+ 1
- 1
openstack_dashboard/dashboards/identity/static/dashboard/identity/domains/domains.module.js View File

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


+ 1
- 1
openstack_dashboard/dashboards/identity/static/dashboard/identity/groups/groups.module.js View File

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


+ 1
- 1
openstack_dashboard/dashboards/identity/static/dashboard/identity/roles/roles.module.js View File

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


+ 1
- 1
openstack_dashboard/dashboards/identity/static/dashboard/identity/users/users.module.js View File

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


+ 6
- 3
openstack_dashboard/dashboards/project/static/dashboard/project/containers/containers.module.js View File

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



+ 1
- 1
openstack_dashboard/static/app/core/flavors/flavors.module.js View File

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


+ 1
- 1
openstack_dashboard/static/app/core/images/images.module.js View File

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


+ 1
- 1
openstack_dashboard/static/app/core/keypairs/keypairs.module.js View File

@@ -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/')


+ 2
- 1
openstack_dashboard/static/app/core/network_qos/qos.module.js View File

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


+ 2
- 1
openstack_dashboard/static/app/core/server_groups/server-groups.module.js View File

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


+ 1
- 1
openstack_dashboard/static/app/core/trunks/trunks.module.js View File

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


+ 38
- 24
openstack_dashboard/static/app/resources/resources.module.js View File

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

Loading…
Cancel
Save