Difference between revisions of "Extensions.I18n.TranslateToLocale"

From emotive
Jump to navigation Jump to search
Line 5: Line 5:
 
== OTL Syntax ==
 
== OTL Syntax ==
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
StringTerm I18n.TranslateToLocale(StringTerm locale, TranslationKeyTerm translationKey, {TranslationArguments[ ] arguments});
+
StringTerm I18n.TranslateToLocale(StringTerm locale, TranslationKeyTerm translationKey, {Term[ ] arguments});
 
</syntaxhighlight>
 
</syntaxhighlight>
  

Revision as of 07:49, 9 November 2018

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 shall 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 shall 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 shall use this string as the target locale for the translation.
TranslationKey TranslationKey Term - [1] This element represents a unique key that the system shall use to search its internal database for a translation.
Arguments TranslationArguments 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