| Localization / Localized strings | |
A localized string is specified in the source code of program modules or form specification files with the %"string" notation, to identify a string that must be replaced at runtime by the corresponding text found in compiled string files. In programs, localized strings can be loaded dynamically with the LSTR() operator.
%"sid"
LSTR(eid)
MAIN DISPLAY %"common.message.welcome" END MAIN
The string after the percent sign defines both the localized string identifier and the default text to be used for extraction, or the default text when no string resource files are provided at runtime.
You can use this notation in form specification files any place where a string literal can be used.LAYOUT
VBOX
GROUP g1 (TEXT=%"group01")
...
LAYOUT
GRID
{
[lab01 |f001 ]
{
END
END
ATTRIBUTES
LABEL lab01: TEXT=%"myform.label01";
EDIT f001 = FORMONLY.field01;
END
The language provides a special operator to load a localized string dynamically, using an expression as string identifier. The name of this operator is LSTR().
MAIN
DEFINE n INTEGER
LET n = 234
DISPLAY LSTR("str"||n) -- loads string 'str234'
END MAIN