Select localized values for a property

The locale function is used to select localized values from the source object.

The locale function is case-sensitive, and all letters are lower-case. The number of positions defines the number of numbered columns that are returned in the results. The locale function returns localized values that are based on the locale selections.

The query results are the property name with a position number suffix, such as property_1, property_2, property_3. The values that are populated in the positions are the localized values matching the locale code, or a search list locale code, for each position.

If the data object does not contain localized values, the property’s string value is returned in position1.The remaining position columns are empty.

Syntax

SELECT locale(localizedproperty, number of positions) FROM object

Example 1

In this example, the Data Catalog has five locale selections: 1 for en_US, 2 for es_ES, 3 for fr_FR, 4 for cz_cz, and 5 for nl_NL. If five positions are selected, these values are returned:

  • greeting_1 for English
  • greeting_2 for Spanish
  • greeting_3 for French
  • greeting_4 for Czech
  • greeting_5 for Dutch
SELECT Id, locale(greeting,5) from common_greetings

This table shows an example:

Id greeting_1 greeting_2 greeting_3 greeting_4 greeting_5

1

hello

hola

bonjour

ahoj

hallo

Example 2

In this example, the Data Catalog has only three locale selections: 1 for en_US, 2 for fr_FR, and 3 for es_ES. If five positions are selected, these values are returned:

  • greeting_1 for English
  • greeting_2 for Spanish
  • greeting_3 for French greeting_4 and greeting_5 is null because no locales are defined for positions 4 and 5.
SELECT Id, locale(greeting,5) from common_greetings

This table shows an example:

Id greeting_1 greeting_2 greeting_3 greeting_4 greeting_5

1

hello

hola

bonjour