ObexTool: How to create and use language files|
How to create and use language files The ObexTool is designed multi-lingual, i.e. the complete user interface may be changed to another language by changing a language file only. The language files are located in the lang subdirectory of the ObexTool. The file format is a typical TCL array with the english messages as index.
Two functions are essential to the language mechanism and are defined in lib/obextool.ini:
If no module name is specified, always the the language file obextool.[language] is addressed.
- load_Messages module language
module is the dictionary name, usually the module name and
language is the second character language extension
- get_text msg [module]
msg is the english message text, which will be translated to the foreign language and the optional
module name addresses the language dictionary.
load_Messages must be called at the beginning of the execution which loads the translated messages.
After loading the message file the function get_text may be used to retrieve the corresponding translation of a message.
The configuration key config language in the configuration file etc/obextool.cfg determines the used language.
Example - assuming the statement:
set ObexConfig(config,language) de in the configuration file etc/obextool.cfg:
The format of a language file is the array set syntax of TCL and the name of the variable must be exactly: "Modulename"_Text, where "Modulename" must be replaced by the module name specified in the load_Messages call.
load_Messages sms_siem [getObexCfg config language]
set sa [get_text "Sender address:" sms_siem]
It is also identical to the module part of the message file name described above - example:
array set sms_siem_Text [list\
"Time stamp:" "Zeitstempel:"\
"Sender address:" "Absenderadresse:"\
Further details about ObexTool you can read on Trouble shooting.
Letzte Änderung: 2018-01-16 15:59