Locale:...File::MO(3)
π Locale::TextDomain::OO::Lexicon::File::MO β bestie edition π
okay so this is a page from the User Contributed Perl Documentation, and it's all about Locale::TextDomain::OO::Lexicon::File::MO. yep. that whole thing. say it three times fast, i dare you π«Ά
πΈ NAME πΈ
Locale::TextDomain::OO::Lexicon::File::MO β gettext mo file as lexicon. that's the whole job, she's a reader, she's a converter, she's iconic β¨
and because the ancients loved metadata, here's the version-control lore, verbatim, do not touch:
$Id: MO.pm 698 2017-09-28 05:21:05Z steffenw $
$HeadURL:
svn:ssh://steffenw@svn.code.sf.net/p/perl-gettext-oo/code/module/trunk/lib/Locale/TextDomain/OO/Lexicon/File/MO.pm
ok bestie, tiny correction, the real line is svn+ssh://steffenw@svn.code.sf.net/p/perl-gettext-oo/code/module/trunk/lib/Locale/TextDomain/OO/Lexicon/File/MO.pm β no cap, that's the URL. π
β¨ VERSION β¨
1.031 β that's the vibe check result, we pass β
π¦ DESCRIPTION π¦
This module reads a gettext mo file into the lexicon. that's it. that's the whole personality. it takes the .mo and goes nom nom nom and now you have lexicon β¨ lowkey magical.
π SYNOPSIS π
here's the whole flex, copy-paste ready, character for character, i would never edit your code bestie:
use Locale::TextDomain::OO::Lexicon::File::MO;
use Log::Any qw($log);
$logger = Locale::TextDomain::OO::Lexicon::File::MO
->new(
# all parameters are optional
decode_code => sub {
my ($charset, $text) = @_;
defined $text
or return $text;
return decode( $charset, $text );
},
# optional
logger => sub {
my ($message, $arg_ref) = @_;
my $type = $arg_ref->{type}; # debug
$log->$type($message);
return;
},
)
->lexicon_ref({
# required
search_dirs => [ qw( ./my_dir ./my_other_dir ) ],
# optional
gettext_to_maketext => $boolean,
# optional
decode => $boolean,
# required
data => [
# e.g. de.mo, en.mo read from:
# search_dir/de.mo
# search_dir/en.mo
'*::' => '*.mo',
# e.g. de.mo en.mo read from:
# search_dir/subdir/de/LC_MESSAGES/domain.mo
# search_dir/subdir/en/LC_MESSAGES/domain.mo
'*:LC_MESSAGES:domain' => 'subdir/*/LC_MESSAGES/domain.mo',
# Merge a region lexicon:
# Take the header and messages of the "de::" lexicon,
# overwrite the header and messages of the "de-at::" lexicon
# and store that as "de-at::" lexicon with all messages now.
merge_lexicon => 'de::', 'de-at::' => 'de-at::',
# Copy a lexicon into another domain and/or category:
copy_lexicon => 'i-default::' => 'i-default:LC_MESSAGES:domain',
# Move a lexicon into another domain and/or category:
move_lexicon => 'i-default::' => 'i-default:LC_MESSAGES:domain',
# Delete a lexicon:
delete_lexicon => 'i-default::',
],
})
->logger;
likeβ¦ the merge/copy/move/delete block? that's the main character energy right there π
π SUBROUTINES/METHODS π
π method new
see SYNOPSIS. (she's mysterious. she's giving less is more. iykyk.)
π method lexicon_ref
See SYNOPSIS. same energy fr fr.
π method read_messages
Called from Locale::TextDomain::OO::Lexicon::Role::File to run the mo file specific code. this is the one that actually does the reading bestie π
$messages_ref = $self->read_messages($filename);
π method logger
Set the logger and get back them. yes, "them" β the method is both the setter and the getter, versatile queen π
$lexicon_file_mo->logger(
sub {
my ($message, $arg_ref) = @_;
my $type = $arg_ref->{type};
$log->$type($message);
return;
},
);
$logger = $lexicon_hash->logger;
$arg_ref contains:
object => $lexicon_file_mo, # the object itself
type => 'debug',
event => 'lexicon,load', # The logger will be copied to
# Locale::TextDomain::OO::Singleton::Lexicon
# so more events are possible.
heads up bestie: thateventcomment means the logger gets copied over toLocale::TextDomain::OO::Singleton::Lexicon, so more events are possible. not me guessing, that's literally what it says π
π EXAMPLE π
Inside of this distribution is a directory named example. Run this *.pl files. go on, run them, they don't bite π¦
π DIAGNOSTICS π
none. silence. no drama. we love a chill module π
π§ CONFIGURATION AND ENVIRONMENT π§
none. zero config, zero env vars, she simply exists β¨
π DEPENDENCIES π
okay so she doesn't come alone, she brings her friends:
Locale::MO::FileMooMooX::StrictConstructorLocale::TextDomain::OO::Lexicon::Role::File
squad goals fr fr π«Ά
π INCOMPATIBILITIES π
not known. (translation: nobody has caught her beefing with anyone yet. keep it that way.)
π BUGS AND LIMITATIONS π
none. no bugs, no limitations, she's literally perfect, and i'm not being biased i'm just reading the page π
β SEE ALSO β
Locale::TextDoamin::OO
bestie don't panic β yes it's spelled TextDoamin and i am keeping it exactly as written, character for character, no fixing, that's the rule π
π AUTHOR π
Steffen Winkler. legend behavior. thank you for your service π«‘
πΈ LICENSE AND COPYRIGHT πΈ
Copyright (c) 2013 - 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, no details skipped, every flag and every path intact π
cute lil sign-off: this is Locale:...File::MO(3) from perl v5.42.0, dated 2025-07-25. slay, goodbye, go read your .mo files πβ¨
π¦ 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