Log::R...::Table(3pm)

πŸ’– Log::R...::Table β€” hey bestie, it's the translation-table manual πŸ’–

okay so you found yourself in Log::R...::Table(3pm), which lives in the User Contributed Perl Documentation corner of your system, and honestly? it's giving foundation. it's the base-class energy that holds a whole little family of translation table tools together. let's get into it 🫢


✨ NAME ✨

Log::Report::Lexicon::Table β€” the generic interface to translation tables. that's it, that's the whole name, no notes πŸ’…


🌸 INHERITANCE 🌸

Log::Report::Lexicon::Table is extended by:

  • Log::Report::Lexicon::MOTcompact
  • Log::Report::Lexicon::POT
  • Log::Report::Lexicon::POTcompact

so like, this is the mom friend and those three are her kids ✨


πŸ¦‹ SYNOPSIS πŸ¦‹

# use one of the extensions, for instance:
my $pot = Log::Report::Lexicon::POT->read('po/nl.po', charset => 'utf-8')
       or panic;

see how we don't use this class directly? we use one of the extensions. pick your fave, they all slay in their own way 😌


πŸ’œ DESCRIPTION πŸ’œ

This base class defines the generic interface for translation tables. like, it's the blueprint. the vibe. the shared language all the extensions speak.

Currently, there are three extensions, and yes we're doing them one by one:

  • Log::Report::Lexicon::POT β€” this one is a relatively heavy implementation, bestie. it doesn't just read PO files, it also writes them. xgettext-perl uses it, for instance, to administer the collection of discovered msgid's. main character energy, honestly πŸ”₯
  • Log::Report::Lexicon::POTcompact β€” light-weighted, read-only access to PO-file information. small. fast. unbothered. πŸͺΆ
  • Log::Report::Lexicon::MOTcompact β€” read-only access to MO-file information. and these binary MO-files? super efficient. no cap πŸ‘‘

🌈 METHODS 🌈

πŸŽ€ Constructors

  • $class->new(%options)

πŸŽ€ Attributes

πŸŽ€ Managing PO's

πŸ“ Translation

  • $obj->msgid( STRING, [$msgctxt] ) β€” look up the Log::Report::Lexicon::PO with the STRING. returns undef when it's not defined. so like, check for undef, don't just assume, i'm begging you πŸ™ˆ
  • $obj->msgstr( $msgid, [$count, $msgctxt] ) β€” returns the translated string for $msgid. and when $count isn't specified? it's 1. default behavior, periodt.

πŸ“ Administration

  • $obj->add($po) β€” adds the information from a $po into this POT. ⚠️ but listen: if the msgid of the $po is already known, that is an error. so don't be out here adding duplicates, bestie, it will absolutely not be cute πŸ’€
  • $obj->header($field) β€” so the translation of a blank MSGID is what gets used to store a MIME header, which contains some meta-data. your $field value gets looked up case-insensitively and then returned. lowercase, uppercase, she does not care 🧚
  • $obj->nrPlurals() β€” returns the number of plurals. when it's not known, you get '2'. that's the fallback, not a guess, that's just the rule ✨
  • $obj->pluralIndex($count) β€” returns the msgstr index used to translate a value of $count.
  • $obj->setupPluralAlgorithm() β€” okay so this one needs to be called after you set (read or create) a new table header, because it's how you interpret the plural algorithm as specified in the "Plural-Forms" header field. there's a [1.09] note here too: the header field is not required when it's not used. so if you're not using it, you're fine, breathe 🫢

and if you want the full list of plural forms per language, it lives here: https://docs.translatehouse.org/projects/localization-guide/en/latest/l10n/pluralforms.html β€” go, it's a whole thing, it's giving academic but useful πŸ“š

  • $obj->translations( [$active] ) β€” returns a list with all defined Log::Report::Lexicon::PO objects. but when you pass the string $active as a parameter, you only get the objects which have references. filtered. curated. iconic.

😭 DIAGNOSTICS 😭

  • Error: invalid plural-form algorithm '$alg' β€” cast by setupPluralAlgorithm(). she said no to that algorithm.
  • Error: only acceptable parameter is 'ACTIVE' β€” cast by translations(). one acceptable string, and that's the one.
  • Error: there is no Plural-Forms field in the header, but needed β€” cast by pluralIndex(). needed it, didn't have it, and now we're here πŸ˜”

🌟 SEE ALSO 🌟

This module is part of Log-Report-Lexicon version 1.15, built on November 06, 2025. Website: http://perl.overmeer.net/CPAN/ β€” go say hi πŸ’–


πŸ‘‘ 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. so like, same terms as perl itself, that's the whole deal, and honestly? generous king behavior 🌈


and that's the page, bestie!! πŸ’… this whole thing shipped as part of the User Contributed Perl Documentation, running on perl v5.40.1, dated 2025-11-11. go forth and translate your tables, you've got this πŸŽ€πŸ’œπŸ¦‹

πŸ“¦ where this page comes from