Locale::TextDomain::OO::Plugin::Expand::BabelFish::Loc - Additional BabelFish methods, prefixed with loc_b
$Id: $
$HeadURL: $
1.024
This module provides translation with BabelFish writing.
Use this plugin for multiple plurals in one phrase otherwise use Locale::TextDomain::OO::Plugin::Expand::Gettext::Loc because that writung is much easier to read for a translation office. Gettext writing has no or constructs and less cryptic chars inside. The translation office needs no programmer experience.
my $loc = Locale::Text::TextDomain::OO->new( plugins => [ qw ( Expand::BabelFish::Loc ... )], ... );
Optional type formatting or grammar stuff see Locale::Utils::PlaceholderBabelFish for possible methods.
$loc->expand_babel_fish_loc->modifier_code($code_ref);
Returns the Locale::Utils::PlaceholderBabelFish object to be able to set some options.
my $expander_object = $self->expand_babel_fish_loc;
e.g.
$self->expand_babel_fish_loc->plural_code( $loc->plural_code, ); $self->expand_gettext->modifier_code( sub { my ( $value, $attribute ) = @_; if ( $attribute eq 'numf' ) { # modify that numeric $value # e.g. change 1234.56 to 1.234,56 or 1,234.56 ... } elsif ( $attribute eq 'accusative' ) { # modify the string with that grammar rule # e.g. needed for East-European languages # write grammar rules only on msgstr/msgstr_plural[n] # and not on msgid ... } ... return $value; }, );
How to build the method name?
Use loc_b and append this with "p".
.------------------------------------------------------------------------. | Snippet | Description | |---------+--------------------------------------------------------------| | p | Context is the first parameter. | '------------------------------------------------------------------------'
Translate only
print $loc->loc_b( 'Hello World!', );
Context
print $loc->loc_bp( 'time', # Context 'to', ); print $loc->loc_bp( 'destination', # Context 'to', );
Use Nloc_b and append this with "p".
The extractor looks for loc_b('... and has no problem with $loc->Nloc_b('....
loc_b('...
$loc->Nloc_b('...
This is the idea of the N-Methods.
$loc->Nloc_b('...'); $loc->Nloc_bp('...', '...');
Inside of this distribution is a directory named example. Run this *.pl files.
confess
none
Locale::Utils::PlaceholderBabelFish
Moo::Role
namespace::autoclean
not known
Locale::TextDoamin::OO
Locale::TextDomain::OO::Plugin::Expand::Gettext::Loc
Steffen Winkler
Copyright (c) 2017, Steffen Winkler <steffenw at cpan.org>. All rights reserved.
<steffenw at cpan.org>
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Locale::TextDomain::OO, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Locale::TextDomain::OO
CPAN shell
perl -MCPAN -e shell install Locale::TextDomain::OO
For more information on module installation, please visit the detailed CPAN module installation guide.