2.4. Performing Translations

It is recommended when writing WebTool modules to place all strings in a separate language file for easier localization. See Section 3.4 for details on the format of these files.

The tmpl_translate method of the $page object is used to perform translations. If you define a template variable in your template to begin with a lang_ prefix, it will be looked up in the appropriate language file and replaced in the template automatically, and tmpl_translate is not required to be called. See Section 3.3 for more information on how templates work.

use WebTool::UI::Std;

my $page = new WebTool::UI::Std;

my $title = $page->tmpl_translate('indextitle');