NAME

Locale::TextDomain::OO::Maketext - A maketext interface for Message Translation

$Id: Maketext.pm 125 2009-11-28 08:50:19Z steffenw $

$HeadURL: https://perl-gettext-oo.svn.sourceforge.net/svnroot/perl-gettext-oo/trunk/lib/Locale/TextDomain/OO/Maketext.pm $

VERSION

0.01

DESCRIPTION

This module provides a maketext interface like Locale::Maketext::Simple for Locale::TextDomain:OO to move projects from Locale::Maketext to Locale::TextDomain.

SYNOPSIS

require Locale::TextDomain::OO::Maketext;

SUBROUTINES/METHODS

method new

See method new at Locale::TextDomain::OO.

There is an extra parameter 'style'.

my $loc = Locale::TextDomain::OO::Maketext->new(
    ...
    style => 'gettext',
    ...
);

Style 'gettext' allows use gettext like data.

%1
%quant(%1,singular,plural)
%*(%1,singular,plural)

instead of

[_1]
[quant,_1,singular,plural]
[*,_1,singular,plural]

Translating methods

maketext

This method includes expnad like 'quant', '*'. This method ignores zero plural forms.

print $loc->maketext(
    'Hello World!',
);

print $loc->maketext(
    'Hello [_1]!',
    'Steffen',
);

print $loc->maketext(
    '[quant,_1,file read,files read]',
    $num_files,
);

maketext_p (allows the context)

print $loc->maketext_p (
    'time',
    'to',
);

print $loc->maketext_p (
    'destination',
    'to',
);

print $loc->maketext_p (
    'destination',
    'from [_1] to [_2]',
    'Chemnitz',
    'Erlangen',
);

print $loc->maketext_p(
    'maskulin',
    'Mr. [_1] has [*,_2,book,books].',
    $name,
    $books,
);

EXAMPLE

Inside of this Distribution is a directory named example. Run this *.pl files.

DIAGNOSTICS

Error message in case of unknown parameters.

Unknown parameter: ...

Error message at calculation plural forms.

Plural-Forms are not defined

Code of Plural-Forms ... is not safe, ...

CONFIGURATION AND ENVIRONMENT

none

DEPENDENCIES

Carp

Cwd

English

I18N::LangTags::Detect

I18N::LangTags

Safe

INCOMPATIBILITIES

not known

BUGS AND LIMITATIONS

none

SEE ALSO

Locale::TextDoamin

Locale::Messages

http://www.gnu.org/software/gettext/manual/gettext.html

http://en.wikipedia.org/wiki/Gettext

http://translate.sourceforge.net/wiki/l10n/pluralforms

http://rassie.org/archives/247 The choice of the right module for the translation.

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.