-
-
15 Mar 2019 15:51:07 UTC
- Distribution: Locale-TextDomain-OO
- Module version: 1.027
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Issues (0)
- Testers (346 / 0 / 1)
- Kwalitee
Bus factor: 1- 80.51% Coverage
- License: perl_5
- Perl: v5.8.0
- Activity
24 month- Tools
- Download (100.82KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
and 1 contributors- Steffen Winkler <steffenw at cpan.org>
- Dependencies
- Carp
- Class::Load
- Clone
- Encode
- English
- Hash::Util
- JSON
- JSON::PP
- Locale::MO::File
- Locale::PO
- Locale::TextDomain::OO::Util
- Locale::TextDomain::OO::Util::ExtractHeader
- Locale::TextDomain::OO::Util::JoinSplitLexiconKeys
- Locale::Utils::PlaceholderBabelFish
- Locale::Utils::PlaceholderMaketext
- Locale::Utils::PlaceholderNamed
- Moo
- Moo::Role
- MooX::Singleton
- MooX::StrictConstructor
- MooX::Types::MooseLike::Base
- Path::Tiny
- Tie::Sub
- Try::Tiny
- namespace::autoclean
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
- NAME
- VERSION
- DESCRIPTION
- SYNOPSIS
- SUBROUTINES/METHODS
- EXAMPLE
- DIAGNOSTICS
- CONFIGURATION AND ENVIRONMENT
- DEPENDENCIES
- INCOMPATIBILITIES
- BUGS AND LIMITATIONS
- SEE ALSO
- AUTHOR
- LICENSE AND COPYRIGHT
NAME
Locale::TextDomain::OO::Plugin::Expand::BabelFish::Loc - Additional BabelFish methods, prefixed with loc_b
$Id: $
$HeadURL: $
VERSION
1.027
DESCRIPTION
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 writing 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.
SYNOPSIS
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);
SUBROUTINES/METHODS
method expand_babel_fish_loc
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_babel_fish_loc->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; }, );
translation methods
How to build the method name?
Use loc_b and append this with "p".
.------------------------------------------------------------------------. | Snippet | Description | |---------+--------------------------------------------------------------| | p | Context is the first parameter. | '------------------------------------------------------------------------'
method loc_b
Translate only
print $loc->loc_b( 'Hello World!', );
method loc_bp
Context
print $loc->loc_bp( 'time', # Context 'to', ); print $loc->loc_bp( 'destination', # Context 'to', );
Methods to mark the translation for extraction only
How to build the method name?
Use Nloc_b and append this with "p".
.------------------------------------------------------------------------. | Snippet | Description | |---------+--------------------------------------------------------------| | p | Context is the first parameter. | '------------------------------------------------------------------------'
methods Nloc_b, Nloc_bp
The extractor looks for
loc_b('...
and has no problem with$loc->Nloc_b('...
.This is the idea of the N-Methods.
$loc->Nloc_b('...'); $loc->Nloc_bp('...', '...');
EXAMPLE
Inside of this distribution is a directory named example. Run this *.pl files.
DIAGNOSTICS
confess
CONFIGURATION AND ENVIRONMENT
none
DEPENDENCIES
Locale::Utils::PlaceholderBabelFish
INCOMPATIBILITIES
not known
BUGS AND LIMITATIONS
none
SEE ALSO
Locale::TextDomain::OO::Plugin::Expand::Gettext::Loc
AUTHOR
Steffen Winkler
LICENSE AND COPYRIGHT
Copyright (c) 2017, 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.
Module Install Instructions
To install Locale::TextDomain::OO, copy and paste the appropriate command in to your terminal.
cpanm Locale::TextDomain::OO
perl -MCPAN -e shell install Locale::TextDomain::OO
For more information on module installation, please visit the detailed CPAN module installation guide.