#1217 Correct the object_name and object_name_plural for plugins
Closed: Fixed None Opened 12 years ago by jraquino.

The WebUI depends on object_name and object_name_plural to be machine readable.

Over time, the plugins have adopted a more human readable syntax for object_name and object_name_plural.

A pair of quick examples are:
object_name = 'Sudo Rule'
object_name = 'HBAC rule'

In order to do membership calculations, the webUI wants to prepend memberof_ to the object_name which is breaking the displaying of some of the relationships represented in the WebUI.


The following plugins have been found to have spaces in the values for object_name and object_name_plural; these spaces could/do cause an issue displaying these plugins via the WebUI.

automount.py: object_name = 'automount location'
automount.py: object_name_plural = 'automount locations'
automount.py: object_name = 'automount map'
automount.py: object_name_plural = 'automount maps'
automount.py: object_name = 'automount key'
automount.py: object_name_plural = 'automount keys'

config.py: object_name = 'configuration options'
dns.py: object_name = 'DNS zone'
dns.py: object_name_plural = 'DNS zones'
dns.py: object_name = 'DNS resource record'
dns.py: object_name_plural = 'DNS resource records'
hbacrule.py: object_name = 'HBAC rule'
hbacrule.py: object_name_plural = 'HBAC rules'
krbtpolicy.py: object_name = 'kerberos ticket policy settings'
pwpolicy.py: object_name = 'password policy'
pwpolicy.py: object_name_plural = 'password policies'
sudorule.py: object_name = 'Sudo Rule'
sudorule.py: object_name_plural = 'Sudo Rules'

This is related to ticket #1249.

The object_name seems to have a dual purpose: as an identifier (lowercase without spaces) to construct attribute names, and as a label (mixed case with spaces) to construct messages. The object_name_plural is only used as a label.

The object_name is used as an identifier in the following location:
- baseldap.py:347

The object_name is used as a label in the following locations:
- baseldap.py:359
- baseldap.py:369
- baseldap.py:636
- baseldap.py:839
- baseldap.py:1094
- baseldap.py:1383
- baseldap.py:1392
- baseldap.py:1570

The object_name_plural is used as a label in the following locations:
- baseldap.py:1093
- baseldap.py:1377-1378
- baseldap.py:1386-1387
- baseldap.py:1568
- migration.py:369
- migration.py:435

There is also a 'label' variable which is similar to object_name_plural. Almost every words in the 'label' starts with a capital letter whereas object_name_plural contains mostly lower case letters except for acronyms. So 'label' is more appropriate for titles and object_name_plural is more appropriate to be used as a regular word in the middle of a sentence.

One possible solution is to use 5 variables:
- object_name for identifier
- object_name_singular for singular regular word
- object_name_plural for plural regular word
- label for plural title
- label_singular for singular title
To reduce translation effort, the object_name_* will be optional. If they are not defined the value will be the same as the corresponding 'label'.

Correction: If the object_name_ are not defined the value will be the same as the corresponding 'label' with all letters turned into lower case (e.g. Host Group -> host group). If the translator wants to preserve some capitalization the object_name_ can be defined explicitly (e.g. DNS Zone -> DNS zone).

Here's the rules we should go by:

All labels should be lower case by default. If they need to be capitalized for a usage, it is up to the programmer to call the locale specific capitalization API to make it happen. These are not proper nouns, and should be lowercase in English.

The label should be the singular form.
The object_name_plural field should be renamed label_plural and surrounded with _() to be picked up by transifex.

The object name should have no spaces in it and be uised only programmatically.

Metadata Update from @jraquino:
- Issue assigned to edewata
- Issue set to the milestone: FreeIPA 2.1 - 2011/07

7 years ago

Login to comment on this ticket.

Metadata