Localization / Using localized strings |
The compiled string files (.42s) must be distributed with the program files in a directory specified in the DBPATH/FGLRESOURCEPATH environment variable.
The locale (LANG/LC_ALL) corresponding to the encoding used in the .42s files must be set before starting the application. If the locale is wrong, the strings will not be loaded properly.
The .42s compiled string resource files are loaded in following order of precedence:
For each string file, the runtime system looks in the following directories:
If a localized string is not defined in one of the compiled string files, the runtime system uses the string identifier as default text.
When a localized string is defined in several compiled string files, the runtime system uses the first string found.
For example, if the string "hello" is defined in program.42s as "hello from program", and in default.42s as "hello from default", the runtime system will use the text "hello from program".
Specify a list of compiled string files with entries in the FGLPROFILE configuration file with the fglrun.localization entries.
fglrun.localization.file.count = integer
fglrun.localization.file.index.name = "filename.42s"
Warning switches can be specified in FGLPROFILE.
fglrun.localization.warnKeyNotFound = boolean
By default, this warning switch is disabled.
A set of .42s files using the same language and codeset is typically copied in a distribution directory with a name identifying the locale.
/opt/app/resource/strings/en_US.iso8859-1 -- English strings in iso8859-1 code-set /opt/app/resource/strings/fr_FR.iso8859-1 -- French strings in iso8859-1 code-set /opt/app/resource/strings/jp_JP.utf8 -- Japanese strings in utf-8 code-set
$ echo $LC_ALL jp_JP.utf8 $ FGLRESOURCEPATH="$FGLRESOURCEPATH:/opt/app/resource/strings/$LC_ALL" $ export FGLRESOURCEPATH $ echo $FGLRESOURCEPATH /opt/app/forms:/opt/app/resource/strings/jp_JP.utf8