Webmin versions 0.75 and above provide module writers with functions for generating different text and messages, depending on the language selected by the user. Each module that wishes to use this feature should have a subdirectory called lang that contains a translation file for each supported language. Each line of a translation file defines a message in that language in the format message_code=Message in this language.
The default language for Webmin is English (code en), so every module should have at least a file called lang/en. If any other language is missing a message, the English one will be used instead. Check the file lang_list.txt for all the languages currently supported and their codes. To change the current language, go into the Webmin Configuration module and click on the Language icon.
When your module calls the init_config function, all the messages from the appropriate translation file will be read into the %text hash. Therefore, instead of generating hard-coded text like this:
print "Click here to start the server:<p> ";
your module should use the %text hash like so:
print $text{'startmsg'},"<p> ";
Messages from the appropriate file in the top-level lang directory are also included in %text. Several useful messages such as save, delete, and create are therefore available to every module.
In some cases, you may want to include some variable text in a message. Because the position of the variable may differ depending on the language used, message strings can include place markers like $1, $2, or $3. The text function should be used to replace these place markers with actual values like:
print &text('servercount', $count),"<p> ";
Your module's module.info file can also support multiple languages by adding a line like desc_code=module description for each language, where code is the language code. You can also have a separate config.info file for each language—called config.info.code—and separate help files for each language, such as intro.code.html. In all cases, if there is no translation for the user's chosen language then the default (English) will be used instead.
18.224.171.70