Translate the given formatted string for current VM language code or user supplied language code.
Syntax |
tr(string text): string tr(string lc, string text): string |
---|---|
text |
Formatted source text |
lc |
Language code |
Result |
Return translated string |
Format string has the following syntax:
<langCode1>=<text1>[^<landCode2>=<text2>[....]] |
Notice that:
•When a required language code is not defined, the first valid is returned;
•The special character ^ separate different translation;
•If format string has not the right syntax, will be treated as a normal string, so it will be not translated;
•Current language code can obtained with languageCode() function.
Examples
Example of use of translation:
string format string value format = "us=English^it=Italian^fr=French"
value = tr(format) ; ---> return Italian if current language is "it" value = tr(format) ; ---> return English if current language is "us" value = tr(format) ; ---> return German if current language is "de" value = tr("fr", format) ; ---> return French value = tr("de", format) ; ---> return German |