Log::R...ompact(3pm)
π NAME π
Log::Report::Lexicon::MOTcompact β bestie, it's the module that pulls your translations straight out of an MO file. π
πΈ INHERITANCE πΈ
Log::Report::Lexicon::MOTcompact is a Log::Report::Lexicon::Table
(so yeah, it's got the whole Table family tree going on β¨)
π¦ SYNOPSIS π¦
# using a MO table efficiently
my $mot = Log::Report::Lexicon::MOTcompact->read('mo/nl.mo')
or die;
my $header = $mot->msgid('');
print $mot->msgstr($msgid, 3);
β¨ DESCRIPTION β¨
Okay so this module does the translating, and it's built on MO files β those are the binary versions of PO files, aka the "Machine Object" format. π¦
Lowkey tea though: this module isn't actually "compact" anymore. It's not out here trading off speed for memory. And ngl, that could totally change again in the future. π
To get a MO file you first need a PO file, and then you run msgfmt, which is part of the gnu gettext package. π
msgfmt -cv -o $domain.mo $domain.po
# -c = --check-format & --check-header & --check-domain
# -v = --verbose
# -o = --output-file
Extends "DESCRIPTION" in Log::Report::Lexicon::Table. π«Ά
π METHODS π
Extends "METHODS" in Log::Report::Lexicon::Table.
π Constructors π
Extends "Constructors" in Log::Report::Lexicon::Table.
$class->new(%options)β inherited, so go read "Constructors" in Log::Report::Lexicon::Table. π$class->read($filename, %options)β reads all the MOT table info out of$filename. π
Here's the option sitch:
-Option --Default charset <from header>
charset=> STRING β the character-set this file is using. If you don't say anything, it gets pulled from the"Content-Type"field in the PO-file. slay β¨
π Attributes π
Extends "Attributes" in Log::Report::Lexicon::Table.
$obj->filename()β returns the name of the source file for this data. ποΈ$obj->index()β returns a HASH of all defined PO objects, organized bymsgid. But bestie, please try to avoid using this β usemsgid()for lookup instead, fr fr. π$obj->originalCharset()β returns the character-set as found in the PO-file. The strings get converted into utf8 before you use them in the program. π¦
π Managing PO's π
Extends "Managing PO's" in Log::Report::Lexicon::Table.
β Translation β
Extends "Translation" in Log::Report::Lexicon::Table.
$obj->msgid( STRING, [$msgctxt] )β looks up the translations with the"STRING". Returns a SCALAR when there's only one translation known, and an ARRAY when we've got plural forms. Returns"undef"when the translation isn't defined. Improves base, see "Translation" in Log::Report::Lexicon::Table. π$obj->msgstr( $msgid, [$count, $msgctxt] )β returns the translated string for$msgid. If you don't specify it,$countis1(the singular form). Improves base, see "Translation" in Log::Report::Lexicon::Table. πΈ
π§ Administration π§
Extends "Administration" in Log::Report::Lexicon::Table.
$obj->add($po)β inherited, see "Administration" in Log::Report::Lexicon::Table. π$obj->header($field)β inherited, see "Administration" in Log::Report::Lexicon::Table. π$obj->nrPlurals()β inherited, see "Administration" in Log::Report::Lexicon::Table. π$obj->pluralIndex($count)β inherited, see "Administration" in Log::Report::Lexicon::Table. π$obj->setupPluralAlgorithm()β inherited, see "Administration" in Log::Report::Lexicon::Table. π$obj->translations( [$active] )β inherited, see "Administration" in Log::Report::Lexicon::Table. π
π DIAGNOSTICS π
the way these all just say "Cast by" β that's the module throwing hands when something goes wrong π
- Error: cannot detect charset in
$fnCast byread() - Fault: cannot read magic from
$fn:$!Cast byread() - Fault: cannot read mo from file
$fn:$!Cast byread() - Fault: cannot read msgids from
$fn, need$sizeat$loc:$!Cast byread() - Fault: cannot read originals from
$fn, need$sizeat$loc:$!Cast byread() - Fault: cannot read superblock from
$fn:$!Cast byread() - Fault: cannot read translations from
$fn, need$sizeat$loc:$!Cast byread() - Fault: cannot read translations from
$fn, need$sizeat$loc:$!Cast byread() - Fault: cannot seek to
$locin$fnfor msgid strings:$!Cast byread() - Fault: cannot seek to
$locin$fnfor originals:$!Cast byread() - Fault: cannot seek to
$locin$fnfor transl strings:$!Cast byread() - Fault: cannot seek to
$locin$fnfor translations:$!Cast byread() - Error: invalid plural-form algorithm
'$alg'Cast bysetupPluralAlgorithm() - Error: only acceptable parameter is
'ACTIVE'Cast bytranslations() - Error: the header is not the first entry, needed for charset in
$fnCast byread() - Error: there is no Plural-Forms field in the header, but needed Cast by
pluralIndex() - Error: unsupported charset
$charsetin$fnCast byread() - Error: unsupported explicit charset
$charsetfor$fnCast byread() - Error: unsupported file type (magic number is
$magic) Cast byread()
π SEE ALSO π
This module is part of Log-Report-Lexicon version 1.15, built on November 06, 2025. Website: http://perl.overmeer.net/CPAN/ π
π LICENSE π
For contributors see file ChangeLog.
This software is copyright (c) 2007-2025 by Mark Overmeer. π
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
and that's a wrap bestie π«Ά this page came from perl v5.40.1, dated 2025-11-11 β no cap, go forth and translate β¨π
π¦ where this page comes from
- ubuntu resolute: liblog-report-lexicon-perl 1.15-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: liblog-report-lexicon-perl 1.15-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms