Locale:...sh::Loc(3)
πΈ Locale:...sh::Loc(3) πΈ
okay bestie, welcome to the User Contributed Perl Documentation corner of the internet π
this is Locale::TextDomain::OO::Plugin::Expand::BabelFish::Loc and she's here to give you extra BabelFish methods, all of them prefixed with loc_b. iykyk π¦
$Id: $
$HeadURL: $
β¨ VERSION β¨
1.027 β yes ma'am, that's the one π
π DESCRIPTION π
so basically this module gives you translation with BabelFish writing π
Use this plugin when you've got multiple plurals crammed into one phrase β otherwise, use Locale::TextDomain::OO::Plugin::Expand::Gettext::Loc, because honestly that writing style is way easier for a translation office to read. Gettext writing has no or constructs and less cryptic chars inside, so the translation office doesn't need programmer experience. it's giving accessible, it's giving considerate, periodt π
π«Ά SYNOPSIS π«Ά
my $loc = Locale::Text::TextDomain::OO->new(
plugins => [ qw (
Expand::BabelFish::Loc
...
)],
...
);
optional type formatting or grammar stuff? peek at Locale::Utils::PlaceholderBabelFish for the possible methods π
$loc->expand_babel_fish_loc->modifier_code($code_ref);
π SUBROUTINES/METHODS π
π§ method expand_babel_fish_loc
Returns the Locale::Utils::PlaceholderBabelFish object, so you can go in and set some options. slay β¨
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
so how do you build the method name? take loc_b and append it with "p" π«
.------------------------------------------------------------------------.
| Snippet | Description |
|---------+--------------------------------------------------------------|
| p | Context is the first parameter. |
'------------------------------------------------------------------------'
π¦ method loc_b
translate only, nothing fancy
print $loc->loc_b(
'Hello World!',
);
π¦ method loc_bp
context, babes β it's the first parameter's whole moment
print $loc->loc_bp(
'time', # Context
'to',
);
print $loc->loc_bp(
'destination', # Context
'to',
);
πΈ Methods to mark the translation for extraction only
how do you build these method names? take Nloc_b and append it with "p" π·
.------------------------------------------------------------------------.
| Snippet | Description |
|---------+-------------------------------------------------------------- |
| p | Context is the first parameter. |
'------------------------------------------------------------------------'
β methods Nloc_b, Nloc_bp
the extractor is out here looking for "loc_b('..." and has zero problem with "$loc->Nloc_b('..." β no cap π
that's literally the whole idea of the N-Methods, bestie
$loc->Nloc_b('...');
$loc->Nloc_bp('...', '...');
π EXAMPLE π
Inside of this distribution is a directory named example. Run this *.pl files. go off, run them π
π DIAGNOSTICS π
confess
π§Έ CONFIGURATION AND ENVIRONMENT π§Έ
none β nothing to configure, she's low maintenance
π DEPENDENCIES π
Locale::Utils::PlaceholderBabelFishMoo::Role
π INCOMPATIBILITIES π
not known β no drama found (yet)
π BUGS AND LIMITATIONS π
none β flawless behaviour, as she deserves π
π SEE ALSO π
Locale::TextDoamin::OOLocale::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.
and that's the whole page, bestie π«Ά this was perl v5.42.0, dated 2025-07-25, brought to you by the fine folks at Locale:...sh::Loc(3) β go translate something iconic πβ¨
π¦ where this page comes from
- fedora 43: perl-Locale-TextDomain-OO 1.036-19.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms