ePages 6.11.0 - DE_EPAGES/Dictionary/API/Localizer.pm

Package DE_EPAGES::Dictionary::API::Localizer

This package replaces dictionary entries in a content with real translations.

Example
use DE_EPAGES::Dictionary::API::Localizer qw ( Replace );
use DE_EPAGES::Dictionary::API::XML::DictionaryImportHandler qw ( ImportDictionary );
my $Dictionary = {};
ImportDictionary($_, $Dictionary) foreach @DictionaryFiles;
if (defined $Dictionary->{$LanguageCode}) {
    $Template = Replace($Template, $Dictionary->{$LanguageCode})
}
@EXPORT_OK
Replace

Functions

Replace
registerHandler

Replace

Exported Function to use this localizer easier. This function registers

to the localizer and starts the localisation process with localize.

Syntax
 $Template = Replace( $MasterTemplate, $hStrings );
Input
$MasterTemplate (string)
a string e.g.: template-content
$hStrings (hash ref)
keyword => value pairs
Return
$Template (string)
the processed template content

registerHandler

Formatter uses this function to add more functionality to this TLE localizer. You can add different types:

Syntax
$ReturnValue = $Localizer->registerHandler( $HandlerType, $Handler, $Name);
Example
$TLEProcessor->registerHandler('FormatHandler', DE_EPAGES::TLE::API::SpaceFormatter->new);
Input
$HandlerType (string)
name of handler
$Handler (ref.*)
the handler object
$Name (string)
name of tle or function