Accessing localized typekeys from Gosu

Gosu provides three String representations that you can use for typekeys.

Typekey property

Description

typelist.typekey.Code

String that represents the typecode

typelist.typekey.DisplayName

Localized language version of the entity name

typelist.typekey.UnlocalizedName

Name listed in the data model

For example, to extract localized information about a typekey, you can use the following:

var displayString = myTypekey.DisplayName

The following code is a more concrete example.

print(AddressType.TC_BUSINESS.DisplayName)

It is important to understand that the display key reference acts as a method call rather than as a value. If the language setting for the user changes, then the display key value changes as well. However, the value stored in displayString does not automatically change as the language changes.