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::Gettext
  • Log::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 $domain for the $locale you indicated. and listen: calling load() 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 a Log::Report::Message object, 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