NAME

Locale::TextDomain::OO::Maketext - An additional maketext interface for Message Translation

$Id: Maketext.pm 255 2009-12-29 14:01:31Z steffenw $

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

VERSION

0.03

DESCRIPTION

This module provides an additional maketext interface like Locale::Maketext::Simple for Locale::TextDomain:OO to port projects from Locale::Maketext.

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 to 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 the expansion as 'quant' or '*'. 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,
);

Nmaketext, Nmaketext_p

The extractor looks for maketext('...') and has no problem with <$loc-Nmaketext('...')>>.

This is the idea of the N-Methods.

$loc->Nmaketext('...');

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

version

parent

Locale::TextDomain::OO

Carp

INCOMPATIBILITIES

not known

BUGS AND LIMITATIONS

none

SEE ALSO

Locale::TextDoamin:OO

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.