Home  Contents

tr:installTranslator

Tr Core4 Lua Commands

SYNOPSIS

trx = tr:installTranslator(lang)

DESCRIPTION

Loads a translation (.qm) file into a translator instance and installs it into the translation table tr.translators for use.

lang is a language specification which indicates the translations to be loaded. When the translation files are managed with Core4Manager, simply specify the language shortcut as seen in the Translation tab of the Project properties dialog. Examples are de, en, de_CH, fr_CH, etc...

Alternatively, you can give a valid filename of a .qm file.

RETURN VALUE

Returns a translator instance on success and nil on failure.

NOTES

The returned translator instance is usually not used directly by the application. It can be used to check for success, however.

The lang variable, when used together with Core4Manager, specifies the language according to ISO639. Optionally the country is added with an underscore according to ISO3166. The latter helps distinguishing of country specific differences, for example use de_CH for german in switzerland.

SEE ALSO