Getting information from a typekey
From Gosu, if you have a reference to a typekey, you can get the following properties from the typekey:
|
Property |
Description |
Context to use |
Example |
|---|---|---|---|
|
|
A non-localized |
If comparing values, sending values to a remote system, or storing values for later comparison |
|
|
|
A localized version of the display name, based on the current language settings. |
For display to a user. This might include sending mail or other notifications in the local language. |
|
|
|
The unlocalized version of the display name. This does not vary on the current language settings. |
Only in debugging or for compatibility with earlier product releases. |
|
|
|
A description of this typekey value’s meaning |
If you need a description (non-localized) from the data model configuration files. |
|
If your application is multi-lingual and manipulates typekeys, choose
very carefully whether you want to get the DisplayName property, the
UnlocalizedName property, or the Code property. In
almost all cases, use the Code if you might store or compare values later
on or use the DisplayName if you are displaying something to the user. The
UnlocalizedName property exists for debugging reasons and compatibility
reasons and in general do not use it. Instead, use Code or
DisplayName.
To extract display name information, you can use
myCode.DisplayName
For example:
print(AddressType.TC_BUSINESS.DisplayName)
This code prints:
Business
