Difference between revisions of "Extensions.I18n.CompareUntranslatedString"

From emotive
Jump to navigation Jump to search
 
(4 intermediate revisions by one other user not shown)
Line 1: Line 1:
[[Category:i18n]]
+
{{DISPLAYTITLE:  '''CompareUntranslatedString '''}}[[Category:i18n]]
 
== Classification ==
 
== Classification ==
{{ClassificationActivity | CompareUntranslatedString | Comparing an untranslated string with translations of the specified '''TranslationKey''' | [[Term]] | [[i18n|OTX i18n extension]] | [[Translation related terms]] | - | - }}
+
{{ClassificationActivity | CompareUntranslatedString | Comparing an untranslated string with translations of the specified '''TranslationKey''' | [[Term]] | [[Extensions.I18n|OTX i18n extension]] | [[Extensions.I18n#Terms|Translation related terms]] | - | - }}
  
 
== Pseudo-Code Syntax ==
 
== Pseudo-Code Syntax ==
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
BooleanTerm = I18n.CompareUntranslatedString(TrasnlationKey, StringTerm);
+
BooleanTerm I18n.CompareUntranslatedString(TranslationKeyTerm translationKey, {Term[ ] arguments}, StringTerm untranslatedString);
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
== Description ==
 
== Description ==
The '''CompareUntranslatedString''' term compares whether an untranslated string matches at least one of the translations of the specified TranslationKey.
+
The '''CompareUntranslatedString''' term compares whether an untranslated string matches at least one of the translations of the specified TranslationKey. While searching for a match, each available locale will be considered by the runtime. The term will return TRUE if and only if a matching translation can be found.
  
{{TermReturnValue| [[Boolean]] | The term will return TRUE if and only if a suitable translation can be found.}}
+
{{TermReturnValue| [[Core.DataTypes.SimpleDataType.Boolean|Boolean]] | The term will return TRUE if and only if a matching translation can be found.}}
  
 
== Properties ==
 
== Properties ==
 
{| {{TableHeader}}
 
{| {{TableHeader}}
 
{{TableRowPropertiesHeader}}
 
{{TableRowPropertiesHeader}}
{{TableRowPropertie1| TrasnlationKey | [[TrasnlationKey]] | [[Term]] | - | [1] | A unique key that the system uses to locate a translation into internal database.}}
+
{{TableRowPropertie2| TranslationKey | [[Extensions.I18n.TranslationKey|TranslationKey]] | [[Term]] | - | [1] | This element represents an unique key that the system will use to search its internal database for a matching translation which matches the untranslated string.}}
{{TableRowPropertie2| UntranslatedString | [[String]] | [[Term]] | - | [1] | The string to be tested for a match.}}
+
{{TableRowPropertie1| Arguments| [[TranslationArguments]] | [[Term]] | - | [0..1] | This optional element represents a list of arguments for the translation.}}
 +
{{TableRowPropertie2| UntranslatedString | [[Core.DataTypes.SimpleDataType.String|String]] | [[Term]] | - | [1] | Represents the string which will be tested for a match.}}
 
|}
 
|}
  
 
== OTL Examples ==
 
== OTL Examples ==
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
 
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;">
Boolean result;
+
/// Local Declarations
 +
 
 
I18n.TranslationKey TranslationKey1;
 
I18n.TranslationKey TranslationKey1;
 +
Boolean Boolean1 = false;
 +
 +
/// Flow
  
 
TranslationKey1 = I18n.CreateTranslationKey("TEXT_1");
 
TranslationKey1 = I18n.CreateTranslationKey("TEXT_1");
result = I18n.CompareUntranslatedString(TranslationKey1, "vehicles", null);
+
Boolean1 = I18n.CompareUntranslatedString(TranslationKey1, NULL, "UntranslatedString");
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
== See also ==
 
== See also ==
[[CreateTranslationKey]] <br/>
+
[[Extensions.I18n.CreateTranslationKey|CreateTranslationKey]] <br/>
[[Translate]] <br/>
+
[[Extensions.I18n.Translate|Translate]] <br/>
[[TranslateToLocale]]
+
[[Extensions.I18n.TranslateToLocale|TranslateToLocale]]

Latest revision as of 02:43, 13 September 2019

Classification

Name CompareUntranslatedString
Short Description Comparing an untranslated string with translations of the specified TranslationKey
Class Term
Extension OTX i18n extension
Group Translation related terms
Exceptions -
Checker Rules -
Standard Compliant Yes

Pseudo-Code Syntax

BooleanTerm I18n.CompareUntranslatedString(TranslationKeyTerm translationKey, {Term[ ] arguments}, StringTerm untranslatedString);

Description

The CompareUntranslatedString term compares whether an untranslated string matches at least one of the translations of the specified TranslationKey. While searching for a match, each available locale will be considered by the runtime. The term will return TRUE if and only if a matching translation can be found.

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
Boolean The term will return TRUE if and only if a matching translation can be found.

Properties

Name Data Type Class Default Cardinality Description
TranslationKey TranslationKey Term - [1] This element represents an unique key that the system will use to search its internal database for a matching translation which matches the untranslated string.
Arguments TranslationArguments Term - [0..1] This optional element represents a list of arguments for the translation.
UntranslatedString String Term - [1] Represents the string which will be tested for a match.

OTL Examples

/// Local Declarations

I18n.TranslationKey TranslationKey1;
Boolean Boolean1 = false;

/// Flow

TranslationKey1 = I18n.CreateTranslationKey("TEXT_1");
Boolean1 = I18n.CompareUntranslatedString(TranslationKey1, NULL, "UntranslatedString");

See also

CreateTranslationKey
Translate
TranslateToLocale