Extensions.I18n.TranslateToLocale

From emotive
Jump to navigation Jump to search

Classification

Name TranslateToLocale
Short Description Performs a similar function to the Translate term
Class Term
Extension OTX i18n extension
Group Translation related terms
Exceptions UnsupportedLocaleException
Checker Rules -
Standard Compliant Yes

OTL Syntax

StringTerm I18n.TranslateToLocale(StringTerm locale, TranslationKeyTerm translationKey, {Term[ ] arguments});

Description

The TranslateToLocale term has a similar function as the Translate term, but instead of using the current locale it will use a target locale that is given as an argument to the call, formed after the rules of the ISO 639-1 standard.

Icons Note.png NOTE – If the format message is invalid, or if an argument in the arguments element is not of the type expected by the format element(s) that use it, an i18nException will be thrown.

Return Value

The Term returns the value, see table below.

Icons Note.png In OTX, Terms are categorized according to its return data type!
Data Type Description
String Localized string in the specified user language.

Properties

Name Data Type Class Default Cardinality Description
Locale String Term - [1] The translation process will use this string as the target locale for the translation.
TranslationKey TranslationKey Term - [1] This element represents a unique key that the system will use to search its internal database for a translation.
Arguments Term Term - [0..1] This optional element represents a list of arguments for the translation.

OTL Examples

/// Local Declarations

I18n.TranslationKey TranslationKey1;
String String1 = "";

/// Flow

TranslationKey1 = I18n.CreateTranslationKey("TEXT_1");
String1 = I18n.TranslateToLocale("en-US", TranslationKey1);

See also

CreateTranslationKey
Translate
CompareUntranslatedString