NAME

Template::Flute::I18N - Localization class for Template::Flute

SYNOPSIS

%german_map = (Cart=> 'Warenkorb', Price => 'Preis');

sub translate {
    my $text = shift;

    return $german_map{$text};
};

$i18n = Template::Flute::I18N->new(\&translate);

$flute = Template::Flute(specification => ...,
                         template => ...,
                         i18n => $i18n);

CONSTRUCTOR

new [CODEREF]

Create a new Template::Flute::I18N object. CODEREF is used by localize method for the text translation.

METHODS

localize STRING

Calls localize function with provided STRING. The result is returned if it contains non blank characters. Otherwise the original STRING is returned.

AUTHOR

Stefan Hornburg (Racke), <racke@linuxia.de>

LICENSE AND COPYRIGHT

Copyright 2010-2021 Stefan Hornburg (Racke) <racke@linuxia.de>.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.