Log::R...nslator(3pm)
π Log::Report::Translator β the manual page, but make it make sense π
okay bestie so this is the Perl doc for Log::Report::Translator, from the User Contributed Perl Documentation collection. she's the base implementation for translating messages and honestly? she's the blueprint, the blueprint π
β¨ NAME β¨
Log::Report::Translator β the base implementation for translating messages, fr fr.
πΈ INHERITANCE πΈ
Log::Report::Translator is extended by:
Log::Report::Translator::GettextLog::Report::Translator::POT
so she's the mom, they're the kids, we love a family tree π«Ά
π¦ SYNOPSIS π¦
first up, the internal infrastructure vibe (iykyk):
# internal infrastructure
my $msg = Log::Report::Message->new(_msgid => "Hello World\n");
print Log::Report::Translator->new(...)->translate($msg);
and then the normal-use era, the one you'll actually touch:
# normal use
textdomain 'my-domain',
translator => Log::Report::Translator->new; # default
print __"Hello World\n";
slay. that's it. that's the whole entrance π
π DESCRIPTION π
so basically: a module (or a whole distribution) has a certain way of translating messages β usually it's "gettext", classic. and the translator is based on some "textdomain" for the message. you can specify that per text element as an option if you want, but usually it's just package scoped. cozy, right?
now the important part, no cap: this base class does not translate at all. not a single word. it will just use the MSGID (and MSGID_PLURAL if that one's available). and honestly? that's a feature. it's a nice fallback for when the language packs aren't installed. she's not failing, she's being flexible ππ
β METHODS β
π Constructors
$class->new(%options)
π Attributes
(the original page just has this heading here, bestie β no items under it, so I'm not inventing any. we respect the source β¨)
π Translating
$obj->load($domain, $locale)β loads the translation info in the text$domainfor the$localeyou indicated. and listen: callingload()multiple times should not cost significant performance, because the data must be cached. so go ahead, call it, she's got it handled π$obj->translate( $message, [$language, $ctxt] )β returns the translation of$message(which is aLog::Report::Messageobject, obviously) based on the current locale.
also a lil PSA: translators are permitted to peek into the internal HASH of the message object β for performance reasons. yes really. it's allowed. don't @ me.
π₯ SEE ALSO π₯
this module is part of Log-Report version 1.46, built on June 16, 2026. cutie's got a birthday π
website: http://perl.overmeer.net/CPAN/
π LICENSE π
for contributors, see file ChangeLog.
this software is copyright (c) 2007-2026 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. periodt π
and that's the whole page, bestie!! π§ this one was perl v5.40.1, dated 2026-07-05, and it came from the Log::R...nslator(3pm) page in the User Contributed Perl Documentation. go forth and translate (or don't, apparently, since the base class literally won't) ππΈπ¦
π¦ where this page comes from
- ubuntu stonking: liblog-report-perl 1.46-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