Localized strings

The Localized Strings feature allows:

This feature can be used to implement internationalization in your application, or to use site-specific text (for example, when business terms change based on territory).

You could have multiple external string files, each containing the translated string in a different language. The DVM (runtime system) searches the files in order to assign text in the report definition. The localized text replaces the captions and other specified text at runtime, choosing the correct string file based on entries in the file fglprofile.

The Source String file

A text file, with a str extension, defines the string to be displayed for the report object captions or the specified Word Box or WordWrap Box text You can check the Text property of the report object to determine the exact string to be replaced.

Syntax:
"identifier" = "string

where:

The backslash "\" is accepted as the escape character, to define non-printable characters.

Example file captions_en.str:
"Userid" = "Client ID"
"Shipcity" = "City"

At runtime, the text 'Userid" or "Shipcity" would be displayed in the report as "Client ID" and "City".

This source string file should be added to the Genero Studio Project Manager application node for your report program, so it can be compiled when the application is built. The compiled file (42s) is not linked into the Genero executable.

Note: Although you can call the API function fgl_report_setCallbackLocalization() in your 4GL source code to specify that the caption of the report object be used instead, we recommend using localized strings.

Using the translate function

Entries in the source string file can also be used by the translate PXML function to replace text in an expression that sets a property value. For example, if you set the text of a Word Box) to this value:
"hello "+"world".translate() 
and you have this entry in the str file:
"world" = "universe"

then the final text displayed on your WordBox will be “hello universe”.

Entries in fglprofile

You can specify the compiled String File, or a list of these files, with entries in an fglprofile configuration file. For example:
fglrun.localization.warnKeyNotFound= false     -- don't display warnings on errors
fglrun.localization.file.count = 1             -- number of string files 
fglrun.localization.file.1.name = "captions_en.42s" -- name of the string file

See the FGLPROFILE topics in the Genero Business Development Language User Guide for complete information about the fglprofile file.

See the Localized Strings topics in the Genero Business Development Language User Guide for complete information and examples.