Difference between revisions of "Extensions.I18n.Translate"

From emotive
Jump to navigation Jump to search
 
(2 intermediate revisions by one other user not shown)
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.Translate(TrasnlationKey translationKey, {Term[ ] arguments});
+
StringTerm I18n.Translate(TranslationKeyTerm translationKey, {Term[ ] arguments});
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
== Description ==
 
== Description ==
The '''Translate''' term accepts a ''TranslationKey'' which may be supplemented by additional translation arguments for message parameter substitution (if required by the associated thesaurus entry). It shall return a localized string in the current user language.
+
The '''Translate''' term accepts a ''TranslationKey'' which may be supplemented by additional translation arguments for message parameter substitution (if required by the associated thesaurus entry). It will return a localized string in the current user language.
  
 
{{Note|If the format message is invalid, or if an argument in the arguments element is not of the type expected
 
{{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 [[Extensions.I18n.I18nException|i18nException]] shall be thrown.}}
+
by the format element(s) that use it, an [[Extensions.I18n.I18nException|i18nException]] will be thrown.}}
  
 
{{TermReturnValue| [[Core.DataTypes.SimpleDataType.String|String]] | Localized string in the current user language.}}
 
{{TermReturnValue| [[Core.DataTypes.SimpleDataType.String|String]] | Localized string in the current user language.}}
Line 19: Line 19:
 
{| {{TableHeader}}
 
{| {{TableHeader}}
 
{{TableRowPropertiesHeader}}
 
{{TableRowPropertiesHeader}}
{{TableRowPropertie1| TranslationKey | [[Extensions.I18n.TranslationKey|TranslationKey]] | [[Term]] | - | [1] | This element represents a unique key that the system shall use to search its internal database for a translation.}}
+
{{TableRowPropertie1| TranslationKey | [[Extensions.I18n.TranslationKey|TranslationKey]] | [[Term]] | - | [1] | This element represents a unique key that the system will use to search its internal database for a translation.}}
{{TableRowPropertie2| Arguments| [[TranslationArguments]] | [[Term]] | - | [0..1] | This optional element represents a list of arguments for the translation.}}
+
{{TableRowPropertie2| Arguments| [[Term]] | [[Term]] | - | [0..1] | This optional element represents a list of arguments for the translation.}}
 
|}
 
|}
  

Latest revision as of 02:42, 13 September 2019

Classification

Name Translate
Short Description Returns a localized string from a TranslationKey
Class Term
Extension OTX i18n extension
Group Translation related terms
Exceptions -
Checker Rules -
Standard Compliant Yes

OTL Syntax

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

Description

The Translate term accepts a TranslationKey which may be supplemented by additional translation arguments for message parameter substitution (if required by the associated thesaurus entry). It will return a localized string in the current user language.

Icons Note.png 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 current user language.

Properties

Name Data Type Class Default Cardinality Description
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.Translate(TranslationKey1);

See also

CreateTranslationKey
TranslateToLocale
CompareUntranslatedString