File: POT.pod

package info (click to toggle)
liblog-report-lexicon-perl 1.12-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 440 kB
  • sloc: perl: 2,673; makefile: 9
file content (130 lines) | stat: -rw-r--r-- 3,420 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
=encoding utf8

=head1 NAME

Log::Report::Translator::POT - translation based on POT files

=head1 INHERITANCE

 Log::Report::Translator::POT
   is a Log::Report::Translator

=head1 SYNOPSIS

 # internal use
 my $msg = Log::Report::Message->new
   ( _msgid  => "Hello World\n"
   , _domain => 'my-domain'
   );

 print Log::Report::Translator::POT
    ->new(lexicons => $dir)
    ->translate($msg, 'nl-BE');

 # normal use (end-users view in the program's ::main)
 textdomain 'my-domain'
   , translator =>  Log::Report::Translator::POT->new(lexicon => $dir);
 print __"Hello World\n";

=head1 DESCRIPTION

Translate a message by directly accessing POT files.  The files will load
lazily (unless forced).  This module accesses the PO's in a compact way,
using L<Log::Report::Lexicon::POTcompact|Log::Report::Lexicon::POTcompact>, which is much more efficient
than L<Log::Report::Lexicon::PO|Log::Report::Lexicon::PO>.

Extends L<"DESCRIPTION" in Log::Report::Translator|Log::Report::Translator/"DESCRIPTION">.
 
=head1 METHODS

Extends L<"METHODS" in Log::Report::Translator|Log::Report::Translator/"METHODS">.
 
=head2 Constructors

Extends L<"Constructors" in Log::Report::Translator|Log::Report::Translator/"Constructors">.
 
=over 4

=item Log::Report::Translator::POT-E<gt>B<new>(%options)

 -Option  --Default
  charset   <undef>
  lexicons  <see text>

=over 2

=item charset => STRING

Enforce character set for files.  We default to reading the character-set
as defined in the header of each PO file.

=item lexicons => DIRECTORY

The DIRECTORY where the translations can be found.  See
L<Log::Report::Lexicon::Index|Log::Report::Lexicon::Index> for the expected structure of such
DIRECTORY.

The default is based on the location of the module which instantiates
this translator.  The filename of the module is stripped from its C<.pm>
extension, and used as directory name.  Within that directory, there
must be a directory named C<messages>, which will be the root directory
of a L<Log::Report::Lexicon::Index|Log::Report::Lexicon::Index>.

=back

example: default lexicon directory

 # file xxx/perl5.8.8/My/Module.pm
 use Log::Report 'my-domain'
   , translator => Log::Report::Translator::POT->new;

 # lexicon now in xxx/perl5.8.8/My/Module/messages/

=back

=head2 Accessors

Extends L<"Accessors" in Log::Report::Translator|Log::Report::Translator/"Accessors">.
 
=over 4

=item $obj-E<gt>B<charset>()

Returns the default charset, which can be overrule by the locale.

=item $obj-E<gt>B<lexicons>()

Returns a list of L<Log::Report::Lexicon::Index|Log::Report::Lexicon::Index> objects, where the
translation files may be located.

=back

=head2 Translating

Extends L<"Translating" in Log::Report::Translator|Log::Report::Translator/"Translating">.
 
=over 4

=item $obj-E<gt>B<load>($domain, $locale)

Inherited, see L<Log::Report::Translator/"Translating">

=item $obj-E<gt>B<translate>( $message, [$language, $ctxt] )

Inherited, see L<Log::Report::Translator/"Translating">

=back

=head1 SEE ALSO

This module is part of Log-Report-Lexicon distribution version 1.12,
built on April 18, 2025. Website: F<http://perl.overmeer.net/CPAN/>

=head1 LICENSE

Copyrights 2007-2025 by [Mark Overmeer <markov@cpan.org>]. For other contributors see ChangeLog.

This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
See F<http://dev.perl.org/licenses/>