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

Code

A non-localized String representation that represents this typekey. Typically you would use this code for exporting this typekey property to an external system. This name is not intended to be a display name, and must contain no space characters and might use abbreviations.

If comparing values, sending values to a remote system, or storing values for later comparison

business

DisplayName

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.

Affaires

UnlocalizedName

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.

Business

Description

A description of this typekey value’s meaning

If you need a description (non-localized) from the data model configuration files.

Business address type

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