File: Textdomain.pod

package info (click to toggle)
liblog-report-template-perl 1.03-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 204 kB
  • sloc: perl: 732; makefile: 2
file content (167 lines) | stat: -rw-r--r-- 4,077 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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
=encoding utf8

=head1 NAME

Log::Report::Template::Textdomain - template translation with one domain

=head1 INHERITANCE

 Log::Report::Template::Textdomain
   is a Log::Report::Domain

=head1 SYNOPSIS

  my $templater = Log::Report::Template->new(...);
  my $domain    = $templater->addTextdomain(%options);

=head1 DESCRIPTION

Manage one translation domain for L<Log::Report::Template|Log::Report::Template>.

=head1 METHODS

=head2 Constructors

=over 4

=item $class-E<gt>B<new>(%options)

Z<>

 -Option              --Default
  lang                  undef
  lexicon               undef
  only_in_directory     undef
  templater             <required>
  translation_function  'loc'

=over 2

=item lang => LANGUAGES

[1.01] Initial language to translate to.  Usually, this language which change
for each user connection via L<translateTo()|Log::Report::Template::Textdomain/"Translating">.

=item lexicon => DIRECTORY

=item only_in_directory => DIRECTORY|ARRAY

The textdomain can only be used in the indicated directories: if found
anywhere else, it's an error.  When not specified, the function is
allowed everywhere.

=item templater => Log::Report::Template-object

=item translation_function => STRING

The name of the function as used in the template to call for translation.
See L<function()|Log::Report::Template::Textdomain/"Attributes">.  It must be unique over all text-domains used.

=back

=item $class-E<gt>B<upgrade>($domain, %options)

Upgrade a base class Log::Report::Domain-object into an Template
domain.

This is a bit akward process, needed when one of the code packages
uses the same domain as the templating system uses.  The generic domain
configuration stays intact.

=back

=head2 Attributes

=over 4

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

Return C<true> when the function name which relates to this domain is
allowed to be used for the indicated file.  The msgid extractor will warn
when there is no match.

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

Returns the name of the function which is used for translations.

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

The language we are going to translate to.  Change this with L<translateTo()|Log::Report::Template::Textdomain/"Translating">
for this domain, or better L<Log::Report::Template::translateTo()|Log::Report::Template/"Attributes">.

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

Directory where the translation tables are kept.

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

The L<Log::Report::Template|Log::Report::Template> object which is using this textdomain.

=back

=head2 Translating

=over 4

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

Set the language to translate to for C<$lang>, for this domain only.  This may
be useful when various text domains do not support the same destination languages.
But in general, you can best use L<Log::Report::Template::translateTo()|Log::Report::Template/"Attributes">.

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

This method returns a CODE which is able to handle a call for
translation by Template Toolkit.

=back

=head1 DIAGNOSTICS

=over 4

=item Warning: Missing key '$key' in format '$format', in $use //template

=encoding utf-8
Cast by translationFunction()

=item Error: extension to domain '$name' already exists

Cast by upgrade()

=item Error: message does not contain counting alternatives in '$msgid'

Cast by translationFunction()

=item Error: no counting positional for '$msgid'

Cast by translationFunction()

=item Error: no counting positional for '$msgid'

Cast by translationFunction()

=item Error: superfluous positional parameters for '$msgid'

Cast by translationFunction()

=item Error: superfluous positional parameters for '$msgid'

Cast by translationFunction()

=back

=head1 SEE ALSO

This module is part of Log-Report-Template version 1.03,
built on September 08, 2025. Website: F<http://perl.overmeer.net/CPAN/>

=head1 LICENSE

For contributors see file ChangeLog.

This software is copyright (c) 2017-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.