1Log::Report::TranslatorU(s3e)r Contributed Perl DocumentaLtoigo:n:Report::Translator(3)
2
3
4

NAME

6       Log::Report::Translator - base implementation for translating messages
7

INHERITANCE

9        Log::Report::Translator is extended by
10          Log::Report::Translator::Gettext
11          Log::Report::Translator::POT
12

SYNOPSIS

14        # internal infrastructure
15        my $msg = Log::Report::Message->new(_msgid => "Hello World\n");
16        print Log::Report::Translator->new(...)->translate($msg);
17
18        # normal use
19        textdomain 'my-domain'
20          , translator => Log::Report::Translator->new;  # default
21        print __"Hello World\n";
22

DESCRIPTION

24       A module (or distribution) has a certain way of translating messages,
25       usually "gettext".  The translator is based on some "textdomain" for
26       the message, which can be specified as option per text element, but
27       usually is package scoped.
28
29       This base class does not translate at all: it will use the MSGID (and
30       MSGID_PLURAL if available).  It's a nice fallback if the language packs
31       are not installed.
32

METHODS

34   Constructors
35       Log::Report::Translator->new(%options)
36
37   Accessors
38   Translating
39       $obj->load($domain, $locale)
40           Load the translation information in the text $domain for the
41           indicated $locale.  Multiple calls to load() should not cost
42           significant performance: the data must be cached.
43
44       $obj->translate( $message, [$language, $ctxt] )
45           Returns the translation of the $message, a "Log::Report::Message"
46           object, based on the current locale.
47
48           Translators are permitted to peek into the internal HASH of the
49           message object, for performance reasons.
50

SEE ALSO

52       This module is part of Log-Report distribution version 1.36, built on
53       October 27, 2023. Website: http://perl.overmeer.net/CPAN/
54

LICENSE

56       Copyrights 2007-2023 by [Mark Overmeer <markov@cpan.org>]. For other
57       contributors see ChangeLog.
58
59       This program is free software; you can redistribute it and/or modify it
60       under the same terms as Perl itself.  See http://dev.perl.org/licenses/
61
62
63
64perl v5.38.0                      2023-10-27        Log::Report::Translator(3)
Impressum