NAME

HTML::Template::Compiled::Plugin::I18N::DefaultTranslator - an extremly simple translater class for the HTC plugin I18N

$Id: DefaultTranslator.pm 150 2009-11-18 20:33:13Z steffenw $

$HeadURL: https://htc-plugin-i18n.svn.sourceforge.net/svnroot/htc-plugin-i18n/trunk/lib/HTML/Template/Compiled/Plugin/I18N/DefaultTranslator.pm $

VERSION

1.00

SYNOPSIS

DESCRIPTION

This module is very useful to run the application before the translator module has finished.

The output string is human readable except the escape callback sub.

SUBROUTINES/METHODS

class method set_escape

Set a escape code reference to escape all the values. The example describes the default to have no undefined values.

HTML::Template::Compiled::Plugin::I18N::DefaultTranslator->set_escape(
    sub {
        my $string = shift;

        defined $string
            and return $string;

        return 'undef';
    },
);

class method get_escape

Get back the current escape code reference.

$code_ref
    = HTML::Template::Compiled::Plugin::I18N::DefaultTranslator->get_escape();

class method translate

Possible hash keys are context, text, plural, maketext, count, gettext, formatter and escape_code. The last one is to escape text and plural after translation.

$string
    = HTML::Template::Compiled::Plugin::I18N::DefaultTranslator->translate({
        text => 'text',
        ...
    });

DIAGNOSTICS

none

CONFIGURATION AND ENVIRONMENT

none

DEPENDENCIES

Carp

INCOMPATIBILITIES

The output is not readable by a parser but very good during the application development.

BUGS AND LIMITATIONS

not known

AUTHOR

Steffen Winkler

LICENSE AND COPYRIGHT

Copyright (c) 2009, Steffen Winkler <steffenw at cpan.org>. All rights reserved.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.