GetPhrase

(VTScada-Layer function. Must be called with a leading backslash.)

Description: Returns text in the currently selected language for a given phrase identifier key or ParmPhrase structure.
Returns: Text
Usage: Script or Steady State
Function Groups:

String and Buffer

Related to: GetParmPhrase | GetDatePhrase | GetTimePhrase | GetPhraseForLang |GetRawPhrase | GetPhraseID
Format: \GetPhrase(PhraseKey)
Parameters:  
PhraseKey

Required. The identifying key for a phrase.

May be either a string that uniquely identifies given text or a ParmPhrase structure, which consists of a PhraseKey and up to 10 parameters.

Comments:

If the input is a ParmPhrase, \GetPhrase will recursively translate the phrase.

In the input is just text (not a phrase key) then it will be passed back unchanged. \GetPhrase("Hello World") returns "Hello World".

If working with parameterized phrases, \GetParmPhrase may be preferred in order to avoid the effort of assembling a ParmPhrase structure, which can be built only in Script.

When called in the context of a user session (e.g. from user-interface code such as a page), the phrase will be returned in the user's currently selected language. Otherwise, the phrase will be returned in the application's default language as specified in the Languages panel of the Application Configuration dialog.

 

As a specialized use-case, GetPhrase also supports the use of translation dictionaries. Use the following information only in the rare case that a standard .csv file of static translations is not suitable.

Translation dictionaries should take the following form, which is used in place of the PhraseKey parameter:

System.MakeDictionary("en", "hello", "fr", "bonjour", "es", "hola");

GetPhrase will then return the translation corresponding to the user's current language. If the dictionary does not include a translation for the user's current language but does for the default language, then the default will be returned. If that also does not exist, then return "Missing translation" (language dependent).

Note that the phrase may not update dynamically when the content for a given key in the dictionary changes.

Translation dictionaries should not be used in most applications.

Example:

  \GetPhrase("OKLabel")

returns "OK", assuming that the current language is English.