distribution Log-Report-0.95.tar.gz
Mark Overmeer authored 11 years ago
Mark Overmeer committed 6 years ago
0 | 0 | |
1 | 1 | ==== version history of Log::Report |
2 | ||
3 | version 0.95: | |
4 | ||
5 | Changes: | |
6 | ||
7 | - new parameters for xgettext-perl, now also able to handle | |
8 | extracting from templates. Script needs man-page. | |
9 | ||
10 | Fixes: | |
11 | ||
12 | - xgettext-perl showed counts twice. | |
13 | ||
14 | - text-domain specified as "qw/domain/" now gets recognized by PerlPPI. | |
15 | ||
16 | Improvements: | |
17 | ||
18 | - some spelling corrections by rt.cpan.org#70959 [Fabrizio Regalli] | |
19 | ||
20 | - synopsis fix in ::Dispatcher::Callback by [gbjk] | |
21 | ||
22 | - cleaned-up the synopsis of Log::Report a bit. | |
23 | ||
24 | - split base-class Log::Report::Extract from ::Extract::PerlPPI | |
25 | ||
26 | - remove dependency to Test::Pod | |
27 | ||
28 | - add Log::Report::Extract::Template and t/42templ.t | |
2 | 29 | |
3 | 30 | version 0.94: Tue Aug 23 11:14:59 CEST 2011 |
4 | 31 |
13 | 13 | lib/Log/Report/Dispatcher/Syslog.pm |
14 | 14 | lib/Log/Report/Dispatcher/Try.pm |
15 | 15 | lib/Log/Report/Exception.pm |
16 | lib/Log/Report/Extract.pm | |
16 | 17 | lib/Log/Report/Extract/PerlPPI.pm |
18 | lib/Log/Report/Extract/Template.pm | |
17 | 19 | lib/Log/Report/Lexicon/Index.pm |
18 | 20 | lib/Log/Report/Lexicon/PO.pm |
19 | 21 | lib/Log/Report/Lexicon/POT.pm |
38 | 40 | t/31stack.t |
39 | 41 | t/40ppi.t |
40 | 42 | t/41die.t |
43 | t/42templ.t | |
41 | 44 | t/50file.t |
42 | 45 | t/51syslog.t |
43 | 46 | t/52logdisp.t |
44 | 47 | t/53log4perl.t |
45 | 48 | t/54try.t |
46 | t/99pod.t | |
47 | 49 | t/DieTests.pm |
48 | 50 | t/hello-world-slovak.po |
51 | xt/99pod.t |
1 | 1 | |
2 | 2 | use 5.008; |
3 | 3 | |
4 | my $version = '0.94'; | |
4 | my $version = '0.95'; | |
5 | 5 | |
6 | 6 | my %prereq = |
7 | 7 | ( Test::More => 0.86 |
8 | , Test::Pod => '1.00' | |
9 | 8 | , Sys::Syslog => '0.27' |
10 | 9 | , Encode => '2.00' |
11 | 10 | , Scalar::Util => 0 |
46 | 45 | |
47 | 46 | # for Log::Report |
48 | 47 | xgettext: $(TO_INST_PM) |
49 | PERL5LIB=lib bin/xgettext-perl --mode=VERBOSE \ | |
50 | -p lib/Log/Report/messages | |
48 | PERL5LIB=lib bin/xgettext-perl --mode=DEBUG \ | |
49 | -p lib/Log/Report/messages lib bin | |
51 | 50 | __POSTAMBLE |
6 | 6 | |
7 | 7 | use Log::Report 'log-report', syntax => 'SHORT'; |
8 | 8 | use Getopt::Long qw/:config no_ignore_case bundling/; |
9 | use File::Find qw/find/; | |
9 | 10 | |
10 | use Log::Report::Extract::PerlPPI; | |
11 | ||
12 | my $from = 'MANIFEST'; | |
13 | my $output; | |
14 | 11 | my $lang = 'perl'; |
15 | my $char_in = 'iso-8859-1'; | |
16 | my $char_out = 'utf-8'; | |
17 | my $merge = 0; | |
18 | 12 | my $version = 0; |
19 | 13 | my $help = 0; |
20 | my $mode; | |
14 | my ($from, $output); | |
15 | my ($char_in, $char_out, $domain, $mode, $template); | |
21 | 16 | |
22 | 17 | GetOptions |
23 | 18 | 'files-from|f=s' => \$from |
24 | 19 | , 'output-dir|p=s' => \$output |
20 | , 'domain|d=s' => \$domain | |
25 | 21 | , 'language|L=s' => \$lang |
26 | 22 | , 'from-code=s' => \$char_in |
27 | 23 | , 'to-code=s' => \$char_out # missing in xgettext? |
28 | , 'join-existing|j=s' => \$merge | |
29 | 24 | , 'version|V' => \$version |
30 | 25 | , 'help|h' => \$help |
26 | , 'template|t=s' => \$template # pattern in ::Template | |
31 | 27 | , 'verbose=i' => \$mode |
32 | 28 | , 'v+' => \$mode |
33 | 29 | , 'mode=s' => \$mode |
46 | 42 | exit 0; |
47 | 43 | } |
48 | 44 | |
45 | # all output to stderr | |
49 | 46 | dispatcher FILE => stderr => to => \*STDERR, mode => $mode; |
47 | dispatcher close => 'default'; | |
50 | 48 | |
51 | $lang eq 'perl' | |
49 | $template || $lang eq 'perl' | |
52 | 50 | or mistake __x"programming language {lang} not supported", lang => $lang; |
53 | 51 | |
54 | 52 | defined $output |
57 | 55 | -d $output or mkdir $output |
58 | 56 | or fault __x"cannot create output directory {dir}", dir => $output; |
59 | 57 | |
60 | # | |
61 | ### process the pm files | |
62 | # | |
58 | my @filenames; | |
59 | if(defined $from) | |
60 | { !@ARGV | |
61 | or error __x"do not combine command-line filenames with --files-from"; | |
63 | 62 | |
64 | my $ppi = Log::Report::Extract::PerlPPI->new | |
65 | ( lexicon => $output | |
66 | , charset => $char_out | |
67 | ); | |
63 | open FILENAMES, '<:raw', $from | |
64 | or fault __x"cannot read filename list from {fn}", fn => $from; | |
68 | 65 | |
69 | open FILENAMES, '<', $from | |
70 | or fault "cannot read filename list from {filename}", filename => $from; | |
71 | ||
72 | while( my $filename = <FILENAMES> ) | |
73 | { chomp $filename; | |
74 | next unless $filename =~ m/\.pm$/; | |
75 | ||
76 | $ppi->process($filename, charset => $char_in); | |
66 | @filenames = <FILENAMES>; | |
67 | close FILENAMES; | |
68 | chomp(@filenames); | |
69 | } | |
70 | elsif(@ARGV) | |
71 | { find sub{push @filenames, $File::Find::name if -f}, @ARGV; | |
77 | 72 | } |
78 | 73 | |
79 | $ppi->showStats; | |
74 | my $extr; | |
80 | 75 | |
81 | $ppi->write; | |
76 | if($template) | |
77 | { # process from template | |
78 | eval "require Log::Report::Extract::Template"; | |
79 | panic $@ if $@; | |
80 | ||
81 | $domain | |
82 | or error __x"specify a text-domain (-d) for the templates"; | |
83 | ||
84 | $extr = Log::Report::Extract::Template->new | |
85 | ( lexicon => $output | |
86 | , charset => $char_out | |
87 | , domain => $domain | |
88 | , pattern => 'TT2-loc' | |
89 | ); | |
90 | ||
91 | $extr->process($_, charset => $char_in) | |
92 | for @filenames; | |
93 | } | |
94 | else | |
95 | { # process the pm files | |
96 | eval "require Log::Report::Extract::PerlPPI"; | |
97 | panic $@ if $@; | |
98 | ||
99 | $extr = Log::Report::Extract::PerlPPI->new | |
100 | ( lexicon => $output | |
101 | , charset => $char_out | |
102 | ); | |
103 | ||
104 | $extr->process($_, charset => $char_in) | |
105 | for @filenames; | |
106 | } | |
107 | ||
108 | $extr->showStats; | |
109 | $extr->write; |
10 | 10 | |
11 | 11 | =chapter SYNOPSIS |
12 | 12 | sub cb($$$) |
13 | { my ($options, $reason, $message) = @_; | |
13 | { my ($disp, $options, $reason, $message) = @_; | |
14 | 14 | ... |
15 | 15 | } |
16 | 16 |
2 | 2 | use strict; |
3 | 3 | |
4 | 4 | package Log::Report::Extract::PerlPPI; |
5 | ||
6 | use Log::Report 'log-report', syntax => 'SHORT'; | |
7 | ||
8 | use Log::Report::Lexicon::Index (); | |
9 | use Log::Report::Lexicon::POT (); | |
10 | ||
5 | use base 'Log::Report::Extract'; | |
6 | ||
7 | use Log::Report 'log-report'; | |
11 | 8 | use PPI; |
12 | 9 | |
13 | 10 | # See Log::Report translation markup functions |
30 | 27 | ( lexicon => '/usr/share/locale' |
31 | 28 | ); |
32 | 29 | $ppi->process('lib/My/Pkg.pm'); # many times |
33 | $ppi->showStats; # to dispatchers which accept TRACE or INFO | |
34 | $ppi->write; # also cleans processing memory. | |
30 | $ppi->showStats; | |
31 | $ppi->write; | |
32 | ||
33 | # See script xgettext-perl | |
35 | 34 | |
36 | 35 | =chapter DESCRIPTION |
37 | 36 | This module helps maintaining the POT files, updating the list of |
44 | 43 | |
45 | 44 | =section Constructors |
46 | 45 | |
47 | =c_method new OPTIONS | |
48 | =requires lexicon DIRECTORY | |
49 | The place where the lexicon is kept. When no lexicon is defined yet, | |
50 | this will be the directory where an C<domain/xx.po> file will be created. | |
51 | ||
52 | =option charset STRING | |
53 | =default charset 'utf-8' | |
54 | The character-set used in the PO files. | |
55 | ||
56 | =cut | |
57 | ||
58 | sub new(@) | |
59 | { my $class = shift; | |
60 | (bless {}, $class)->init( {@_} ); | |
61 | } | |
62 | ||
63 | sub init($) | |
64 | { my ($self, $args) = @_; | |
65 | my $lexi = $args->{lexicon} | |
66 | or error __"PerlPPI requires explicit lexicon directory"; | |
67 | ||
68 | -d $lexi or mkdir $lexi | |
69 | or fault __x"cannot create lexicon directory {dir}", dir => $lexi; | |
70 | ||
71 | $self->{index} = Log::Report::Lexicon::Index->new($lexi); | |
72 | $self->{charset} = $args->{charset} || 'utf-8'; | |
73 | $self; | |
74 | } | |
75 | ||
76 | 46 | =section Accessors |
77 | ||
78 | =method index | |
79 | Returns the M<Log::Report::Lexicon::Index> object, which is listing | |
80 | the files in the lexicon directory tree. | |
81 | ||
82 | =method charset | |
83 | Returns the character-set used inside the POT files. | |
84 | ||
85 | =method domains | |
86 | Returns a sorted list of all known domain names. | |
87 | =cut | |
88 | ||
89 | sub index() {shift->{index}} | |
90 | sub charset() {shift->{charset}} | |
91 | sub domains() {sort keys %{shift->{domains}}} | |
92 | 47 | |
93 | 48 | =section Processors |
94 | 49 | |
105 | 60 | { my ($self, $fn, %opts) = @_; |
106 | 61 | |
107 | 62 | my $charset = $opts{charset} || 'iso-8859-1'; |
108 | info __x"processing file {fn} in {charset}", fn=> $fn, charset => $charset; | |
109 | 63 | |
110 | 64 | $charset eq 'iso-8859-1' |
111 | 65 | or error __x"PPI only supports iso-8859-1 (latin-1) on the moment"; |
113 | 67 | my $doc = PPI::Document->new($fn, readonly => 1) |
114 | 68 | or fault __x"cannot read from file {filename}", filename => $fn; |
115 | 69 | |
116 | my ($pkg, $include, $domain) = ('main', 0, undef); | |
70 | my @childs = $doc->schildren; | |
71 | if(@childs==1 && ref $childs[0] eq 'PPI::Statement') | |
72 | { info __x"no Perl in file {filename}", filename => $fn; | |
73 | return 0; | |
74 | } | |
75 | ||
76 | info __x"processing file {fn} in {charset}", fn=> $fn, charset => $charset; | |
77 | my ($pkg, $include, $domain, $msgs_found) = ('main', 0, undef, 0); | |
117 | 78 | |
118 | 79 | NODE: |
119 | 80 | foreach my $node ($doc->schildren) |
120 | 81 | { if($node->isa('PPI::Statement::Package')) |
121 | 82 | { $pkg = $node->namespace; |
122 | 83 | |
123 | # special hack for module Log::Report itself | |
84 | # special hack needed for module Log::Report itself | |
124 | 85 | if($pkg eq 'Log::Report') |
125 | 86 | { ($include, $domain) = (1, 'log-report'); |
126 | 87 | $self->_reset($domain, $fn); |
127 | 88 | } |
128 | 89 | else { ($include, $domain) = (0, undef) } |
129 | ||
130 | 90 | next NODE; |
131 | 91 | } |
132 | 92 | |
133 | 93 | if($node->isa('PPI::Statement::Include')) |
134 | { next NODE if $node->type ne 'use' || $node->module ne 'Log::Report'; | |
94 | { $node->type eq 'use' && $node->module eq 'Log::Report' | |
95 | or next NODE; | |
96 | ||
135 | 97 | $include++; |
136 | 98 | my $dom = ($node->schildren)[2]; |
137 | $domain = $dom->isa('PPI::Token::Quote') ? $dom->string : undef; | |
99 | $domain | |
100 | = $dom->isa('PPI::Token::Quote') ? $dom->string | |
101 | : $dom->isa('PPI::Token::QuoteLike::Words') ? ($dom->literal)[0] | |
102 | : undef; | |
103 | ||
138 | 104 | $self->_reset($domain, $fn); |
139 | 105 | } |
140 | 106 | |
143 | 109 | $_[1]->isa('PPI::Token::Word') or return 0; |
144 | 110 | |
145 | 111 | my $node = $_[1]; |
146 | my $def = $msgids{$node->content} | |
112 | my $def = $msgids{$node->content} # get __() description | |
147 | 113 | or return 0; |
148 | 114 | |
149 | 115 | my @msgids = $self->_get($node, @$def) |
152 | 118 | my $line = $node->location->[0]; |
153 | 119 | unless($domain) |
154 | 120 | { mistake __x |
155 | "no textdomain for translatable at {fn} line {line}" | |
121 | "no text-domain for translatable at {fn} line {line}" | |
156 | 122 | , fn => $fn, line => $line; |
157 | 123 | return 0; |
158 | 124 | } |
159 | 125 | |
160 | if($def->[4]) # split | |
161 | { $self->_store($domain, $fn, $line, $_) | |
162 | for map {split} @msgids; | |
126 | if($def->[4]) # must split? Bulk conversion strings | |
127 | { my @words = map {split} @msgids; | |
128 | $self->store($domain, $fn, $line, $_) for @words; | |
129 | $msgs_found += @words; | |
163 | 130 | } |
164 | 131 | else |
165 | { $self->_store($domain, $fn, $line, @msgids); | |
132 | { $self->store($domain, $fn, $line, @msgids); | |
133 | $msgs_found += 1; | |
166 | 134 | } |
167 | 135 | |
168 | 136 | 0; # don't collect |
169 | 137 | } |
170 | 138 | ); |
171 | 139 | } |
140 | ||
141 | $msgs_found; | |
172 | 142 | } |
173 | 143 | |
174 | sub _get($$$$$) | |
144 | sub _get($@) | |
175 | 145 | { my ($self, $node, $msgids, $count, $opts, $vars, $split) = @_; |
176 | 146 | my $list_only = ($msgids > 1) || $count || $opts || $vars; |
177 | 147 | my $expand = $opts || $vars; |
226 | 196 | @msgids; |
227 | 197 | } |
228 | 198 | |
229 | =method showStats [DOMAINs] | |
230 | Show a status about the DOMAIN (by default all domains). At least mode | |
231 | verbose is required to see this. | |
232 | =cut | |
233 | ||
234 | sub showStats(;$) | |
235 | { dispatcher needs => 'INFO' | |
236 | or return; | |
237 | ||
238 | my $self = shift; | |
239 | my @domains = @_ ? @_ : $self->domains; | |
240 | ||
241 | foreach my $domain (@domains) | |
242 | { my $pots = $self->{domains}{$domain} or next; | |
243 | my ($msgids, $fuzzy, $inactive) = (0, 0, 0); | |
244 | ||
245 | foreach my $pot (@$pots) | |
246 | { my $stats = $pot->stats; | |
247 | next unless $stats->{fuzzy} || $stats->{inactive}; | |
248 | ||
249 | $msgids = $stats->{msgids}; | |
250 | next if $msgids == $stats->{fuzzy}; # ignore the template | |
251 | ||
252 | notice __x | |
253 | "{domain}: {fuzzy%3d} fuzzy, {inact%3d} inactive in {filename}" | |
254 | , domain => $domain, fuzzy => $stats->{fuzzy} | |
255 | , inact => $stats->{inactive}, filename => $pot->filename; | |
256 | ||
257 | $fuzzy += $stats->{fuzzy}; | |
258 | $inactive += $stats->{inactive}; | |
259 | } | |
260 | ||
261 | if($fuzzy || $inactive) | |
262 | { info __xn | |
263 | "{domain}: one file with {ids} msgids, {f} fuzzy and {i} inactive translations" | |
264 | , "{domain}: {_count} files each {ids} msgids, {f} fuzzy and {i} inactive translations in total" | |
265 | , scalar(@$pots), domain => $domain | |
266 | , f => $fuzzy, ids => $msgids, i => $inactive | |
267 | } | |
268 | else | |
269 | { info __xn | |
270 | "{domain}: one file with {ids} msgids" | |
271 | , "{domain}: {_count} files with each {ids} msgids" | |
272 | , scalar(@$pots), domain => $domain, ids => $msgids; | |
273 | } | |
274 | } | |
275 | } | |
276 | ||
277 | =method write [DOMAIN] | |
278 | Update the information of the files related to DOMAIN, by default all | |
279 | processed DOMAINS. All information known about the DOMAIN is removed | |
280 | from the cache. | |
281 | =cut | |
282 | ||
283 | sub write(;$) | |
284 | { my ($self, $domain) = @_; | |
285 | unless(defined $domain) # write all | |
286 | { $self->write($_) for keys %{$self->{domains}}; | |
287 | return; | |
288 | } | |
289 | ||
290 | my $pots = delete $self->{domains}{$domain} | |
291 | or return; # nothing found | |
292 | ||
293 | for my $pot (@$pots) | |
294 | { $pot->updated; | |
295 | $pot->write; | |
296 | } | |
297 | ||
298 | $self; | |
299 | } | |
300 | ||
301 | sub DESTROY() {shift->write} | |
302 | ||
303 | sub _reset($$) | |
304 | { my ($self, $domain, $fn) = @_; | |
305 | ||
306 | my $pots = $self->{domains}{$domain} | |
307 | ||= $self->_read_pots($domain); | |
308 | ||
309 | $_->removeReferencesTo($fn) for @$pots; | |
310 | } | |
311 | ||
312 | sub _read_pots($) | |
313 | { my ($self, $domain) = @_; | |
314 | ||
315 | my $index = $self->index; | |
316 | my $charset = $self->charset; | |
317 | ||
318 | my @pots = map {Log::Report::Lexicon::POT->read($_, charset=> $charset)} | |
319 | $index->list($domain); | |
320 | ||
321 | trace __xn "found one pot file for domain {domain}" | |
322 | , "found {_count} pot files for domain {domain}" | |
323 | , @pots, domain => $domain; | |
324 | ||
325 | @pots && return \@pots; | |
326 | ||
327 | # new textdomain | |
328 | my $fn = $index->addFile("$domain.$charset.po"); | |
329 | info __x"starting new textdomain {domain}, template in {filename}" | |
330 | , domain => $domain, filename => $fn; | |
331 | ||
332 | my $pot = Log::Report::Lexicon::POT->new | |
333 | ( textdomain => $domain | |
334 | , filename => $fn | |
335 | , charset => $charset | |
336 | , version => 0.01 | |
337 | ); | |
338 | ||
339 | [ $pot ]; | |
340 | } | |
341 | ||
342 | sub _store($$$$;$) | |
343 | { my ($self, $domain, $fn, $linenr, $msgid, $plural) = @_; | |
344 | ||
345 | foreach my $pot ( @{$self->{domains}{$domain}} ) | |
346 | { if(my $po = $pot->msgid($msgid)) | |
347 | { $po->addReferences( ["$fn:$linenr"]); | |
348 | $po->plural($plural) if $plural; | |
349 | next; | |
350 | } | |
351 | ||
352 | my $format = $msgid =~ m/\{/ ? 'perl-brace' : 'perl'; | |
353 | my $po = Log::Report::Lexicon::PO->new | |
354 | ( msgid => $msgid | |
355 | , msgid_plural => $plural | |
356 | , fuzzy => 1 | |
357 | , format => $format | |
358 | , references => [ "$fn:$linenr" ] | |
359 | ); | |
360 | ||
361 | $pot->add($po); | |
362 | } | |
363 | } | |
364 | ||
365 | 199 | 1; |
0 | ||
1 | use warnings; | |
2 | use strict; | |
3 | ||
4 | package Log::Report::Extract::Template; | |
5 | use base 'Log::Report::Extract'; | |
6 | ||
7 | use Log::Report 'log-report'; | |
8 | ||
9 | =chapter NAME | |
10 | Log::Report::Extract::Template - Collect translatable strings from templates | |
11 | ||
12 | =chapter SYNOPSIS | |
13 | my $extr = Log::Report::Extract::Template->new | |
14 | ( lexicon => '/usr/share/locale' | |
15 | , domain => 'my-web-site' | |
16 | , pattern => 'TT2-loc' | |
17 | ); | |
18 | $extr->process('website/page.html'); # many times | |
19 | $extr->showStats; | |
20 | $extr->write; | |
21 | ||
22 | # See script xgettext-perl | |
23 | ||
24 | =chapter DESCRIPTION | |
25 | This module helps maintaining the POT files which list translatable | |
26 | strings from template files by updating the list of message-ids which | |
27 | are kept in them. | |
28 | ||
29 | After initiation, the M<process()> method needs to be called with | |
30 | all files which changed since last processing and the existing PO | |
31 | files will get updated accordingly. If no translations exist yet, | |
32 | one C<textdomain/xx.po> file will be created. | |
33 | ||
34 | =chapter METHODS | |
35 | ||
36 | =section Constructors | |
37 | ||
38 | =c_method new OPTIONS | |
39 | ||
40 | =requires domain DOMAIN | |
41 | There is no syntax for specifying domains in templates (yet), so you | |
42 | must be explicit about the collection we are making now. | |
43 | ||
44 | =option pattern PREDEFINED|REGEX | |
45 | =default pattern <undef> | |
46 | See the DETAILS section below for a detailed explenation. | |
47 | =cut | |
48 | ||
49 | sub init($) | |
50 | { my ($self, $args) = @_; | |
51 | $self->SUPER::init($args); | |
52 | $self->{LRET_domain} = $args->{domain} | |
53 | or error "template extract requires explicit domain"; | |
54 | ||
55 | $self->{LRET_pattern} = $self->_pattern($args->{pattern}); | |
56 | $self; | |
57 | } | |
58 | ||
59 | =section Accessors | |
60 | =method domain | |
61 | =method pattern | |
62 | =cut | |
63 | ||
64 | sub domain() {shift->{LRET_domain}} | |
65 | sub pattern() {shift->{LRET_pattern}} | |
66 | ||
67 | =section Processors | |
68 | ||
69 | =method process FILENAME, OPTIONS | |
70 | Update the domains mentioned in the FILENAME. All textdomains defined | |
71 | in the file will get updated automatically, but not written before | |
72 | all files where processed. | |
73 | ||
74 | =option charset STRING | |
75 | =default charset 'utf-8' | |
76 | The character encoding used in this template file. | |
77 | ||
78 | =option pattern PREDEFINED|REGEX | |
79 | =default pattern <from new(pattern)> | |
80 | Read the DETAILS section about this. | |
81 | =cut | |
82 | ||
83 | sub process($@) | |
84 | { my ($self, $fn, %opts) = @_; | |
85 | ||
86 | my $charset = $opts{charset} || 'utf-8'; | |
87 | info __x"processing file {fn} in {charset}", fn=> $fn, charset => $charset; | |
88 | ||
89 | # Slurp the whole file | |
90 | local *IN; | |
91 | open IN, "<:encoding($charset)", $fn | |
92 | or fault __x"cannot read template from {fn}", fn => $fn; | |
93 | ||
94 | undef $/; | |
95 | my $text = <IN>; | |
96 | close IN; | |
97 | ||
98 | my $domain = $self->domain; | |
99 | $self->_reset($domain, $fn); | |
100 | ||
101 | my $pattern = $self->_pattern($opts{pattern}) || $self->pattern | |
102 | or error __"need pattern to scan for, either via new() or process()"; | |
103 | ||
104 | # Split the whole file on the pattern in four fragments per match: | |
105 | # (text, leading, needed trailing, text, leading, ...) | |
106 | # f.i. ('', '[% loc("', 'some-msgid', '", params) %]', ' more text') | |
107 | my @frags = split $pattern, $text; | |
108 | ||
109 | my $linenr = 1; | |
110 | my $msgs_found = 0; | |
111 | ||
112 | while(@frags > 4) | |
113 | { $linenr += ($frags[0] =~ tr/\n//) # text | |
114 | + ($frags[1] =~ tr/\n//); # leading | |
115 | (my $msgid = $frags[2]) =~ s/^(['"]*)(.*?)\1/$2/; | |
116 | $self->store($domain, $fn, $linenr, $msgid); | |
117 | $msgs_found++; | |
118 | $linenr += ($frags[2] =~ tr/\n//) | |
119 | + ($frags[3] =~ tr/\n//); | |
120 | splice @frags, 0, 4; | |
121 | } | |
122 | ||
123 | $msgs_found; | |
124 | } | |
125 | ||
126 | #---------------------------------------------------- | |
127 | =chapter DETAILS | |
128 | ||
129 | =section Scan Patterns | |
130 | Various template systems use different conventions for denoting strings | |
131 | to be translated. | |
132 | ||
133 | =subsection Your own regular expression | |
134 | If you do not have a format which is predefined, then you can pass-in | |
135 | your own regular expression. Be sure it captures three components: | |
136 | the beginning of the markup, the msgid to be included in the translation | |
137 | table, and the ending of the markup. | |
138 | ||
139 | Example: | |
140 | ||
141 | pattern => qr/(<")(.*?)(">)/ | |
142 | ||
143 | This would match | |
144 | ||
145 | <"Hello, World"> | |
146 | ||
147 | The markup compenents must contain all allowed white-spacing, to be able | |
148 | to produce the correct line-numbers. Enclosing single and double quotes | |
149 | aroung the msgid will get removed, if still present after the match. | |
150 | ||
151 | =subsection Predefined for Template::Toolkit | |
152 | There is not a single convertion for translations in M<Template::Toolkit>, | |
153 | so you need to specify which version you use and which function you want | |
154 | to run. | |
155 | ||
156 | For instance | |
157 | ||
158 | pattern => 'TT2-loc' | |
159 | ||
160 | will scan for | |
161 | ||
162 | [% loc("msgid", params) %] | |
163 | ||
164 | For TT1, the brackets can either be '[%...%]' or '%%...%%'. The function | |
165 | name is treated case-sensitive. Some people prefer 'l()'. | |
166 | =cut | |
167 | ||
168 | sub _pattern($) | |
169 | { my ($self, $pattern) = @_; | |
170 | ||
171 | return $pattern | |
172 | if !defined $pattern || ref $pattern eq 'Regexp'; | |
173 | ||
174 | if($pattern =~ m/^TT([12])-(\w+)$/) | |
175 | { # Recognized is Template::Toolkit 2 | |
176 | my ($level, $function) = ($1, $2); | |
177 | my ($open, $close) = $level==1 ? ('[\[%]%', '%[\]%]') : ('\[%', '%\]'); | |
178 | ||
179 | return qr/( $open \s* \Q$function\E \s* \( \s* ) # leading | |
180 | ( "[^"\s]*" | '[^']*' ) # msgid | |
181 | ( .*? # params | |
182 | $close ) # ending | |
183 | /xs; | |
184 | } | |
185 | ||
186 | error __x"scan pattern `{pattern}' not recognized", pattern => $pattern; | |
187 | } | |
188 | ||
189 | 1; |
0 | ||
1 | use warnings; | |
2 | use strict; | |
3 | ||
4 | package Log::Report::Extract; | |
5 | ||
6 | use Log::Report 'log-report'; | |
7 | use Log::Report::Lexicon::Index (); | |
8 | use Log::Report::Lexicon::POT (); | |
9 | ||
10 | =chapter NAME | |
11 | Log::Report::Extract - Collect translatable strings | |
12 | ||
13 | =chapter SYNOPSIS | |
14 | # See the extensions | |
15 | ||
16 | =chapter DESCRIPTION | |
17 | This module helps maintaining the POT files, updating the list of | |
18 | message-ids which are kept in them. After initiation, the M<process()> | |
19 | method needs to be called with all files which changed since last | |
20 | processing and the existing PO files will get updated accordingly. If no | |
21 | translations exist yet, one C<textdomain/xx.po> file will be created. | |
22 | ||
23 | =chapter METHODS | |
24 | ||
25 | =section Constructors | |
26 | ||
27 | =c_method new OPTIONS | |
28 | =requires lexicon DIRECTORY | |
29 | The place where the lexicon is kept. When no lexicon is defined yet, | |
30 | this will be the directory where an C<domain/xx.po> file will be created. | |
31 | ||
32 | =option charset STRING | |
33 | =default charset 'utf-8' | |
34 | The character-set used in the PO files. | |
35 | ||
36 | =cut | |
37 | ||
38 | sub new(@) | |
39 | { my $class = shift; | |
40 | (bless {}, $class)->init( {@_} ); | |
41 | } | |
42 | ||
43 | sub init($) | |
44 | { my ($self, $args) = @_; | |
45 | my $lexi = $args->{lexicon} | |
46 | or error __"extractions require an explicit lexicon directory"; | |
47 | ||
48 | -d $lexi or mkdir $lexi | |
49 | or fault __x"cannot create lexicon directory {dir}", dir => $lexi; | |
50 | ||
51 | $self->{LRE_index} = Log::Report::Lexicon::Index->new($lexi); | |
52 | $self->{LRE_charset} = $args->{LRE_charset} || 'utf-8'; | |
53 | $self->{LRE_domains} = {}; | |
54 | $self; | |
55 | } | |
56 | ||
57 | =section Accessors | |
58 | ||
59 | =method index | |
60 | Returns the M<Log::Report::Lexicon::Index> object, which is listing | |
61 | the files in the lexicon directory tree. | |
62 | ||
63 | =method charset | |
64 | Returns the character-set used inside the POT files. | |
65 | ||
66 | =method domains | |
67 | Returns a sorted list of all known domain names. | |
68 | ||
69 | =method pots DOMAIN | |
70 | Returns the list of M<Log::Report::Lexicon::POT> objects which contain | |
71 | the tables for DOMAIN. | |
72 | =cut | |
73 | ||
74 | sub index() {shift->{LRE_index}} | |
75 | sub charset() {shift->{LRE_charset}} | |
76 | sub domains() {sort keys %{shift->{LRE_domains}}} | |
77 | sub pots($) | |
78 | { my ($self, $domain) = @_; | |
79 | my $r = $self->{LRE_domains}{$domain}; | |
80 | $r ? @$r : (); | |
81 | } | |
82 | ||
83 | =section Processors | |
84 | ||
85 | =method process FILENAME, OPTIONS | |
86 | Update the domains mentioned in the FILENAME. All text-domains defined | |
87 | in the file will get updated automatically, but should not written before | |
88 | all files are processed. | |
89 | ||
90 | Returned is the number of messages found in this particular file. | |
91 | =cut | |
92 | ||
93 | sub process($@) | |
94 | { my ($self, $fn, %opts) = @_; | |
95 | panic "not implemented"; | |
96 | } | |
97 | ||
98 | =method showStats [DOMAINs] | |
99 | Show a status about the DOMAIN (by default all domains). At least mode | |
100 | verbose is required to see this. | |
101 | ||
102 | The statistics are sent to (Log::Report) dispatchers which accept | |
103 | notice and info. This could be syslog. When you have no explicit | |
104 | dispatchers in your program, the level of detail get controled by | |
105 | the 'mode': | |
106 | ||
107 | use Log::Report mode => 'DEBUG'; # or 'VERBOSE' | |
108 | =cut | |
109 | ||
110 | sub showStats(;$) | |
111 | { dispatcher needs => 'INFO' | |
112 | or return; | |
113 | ||
114 | my $self = shift; | |
115 | my @domains = @_ ? @_ : $self->domains; | |
116 | ||
117 | foreach my $domain (@domains) | |
118 | { my $pots = $self->{LRE_domains}{$domain} or next; | |
119 | my ($msgids, $fuzzy, $inactive) = (0, 0, 0); | |
120 | ||
121 | foreach my $pot (@$pots) | |
122 | { my $stats = $pot->stats; | |
123 | next unless $stats->{fuzzy} || $stats->{inactive}; | |
124 | ||
125 | $msgids = $stats->{msgids}; | |
126 | next if $msgids == $stats->{fuzzy}; # ignore the template | |
127 | ||
128 | notice __x | |
129 | "{domain}: {fuzzy%3d} fuzzy, {inact%3d} inactive in {filename}" | |
130 | , domain => $domain, fuzzy => $stats->{fuzzy} | |
131 | , inact => $stats->{inactive}, filename => $pot->filename; | |
132 | ||
133 | $fuzzy += $stats->{fuzzy}; | |
134 | $inactive += $stats->{inactive}; | |
135 | } | |
136 | ||
137 | if($fuzzy || $inactive) | |
138 | { info __xn | |
139 | "{domain}: one file with {ids} msgids, {f} fuzzy and {i} inactive translations" | |
140 | , "{domain}: {_count} files each {ids} msgids, {f} fuzzy and {i} inactive translations in total" | |
141 | , scalar(@$pots), domain => $domain | |
142 | , f => $fuzzy, ids => $msgids, i => $inactive | |
143 | } | |
144 | else | |
145 | { info __xn | |
146 | "{domain}: one file with {ids} msgids" | |
147 | , "{domain}: {_count} files with each {ids} msgids" | |
148 | , scalar(@$pots), domain => $domain, ids => $msgids; | |
149 | } | |
150 | } | |
151 | } | |
152 | ||
153 | =method write [DOMAIN] | |
154 | Update the information of the files related to DOMAIN, by default all | |
155 | processed DOMAINS. | |
156 | ||
157 | All information known about the written DOMAIN is removed from the cache. | |
158 | =cut | |
159 | ||
160 | sub write(;$) | |
161 | { my ($self, $domain) = @_; | |
162 | unless(defined $domain) # write all | |
163 | { $self->write($_) for $self->domains; | |
164 | return; | |
165 | } | |
166 | ||
167 | my $pots = delete $self->{LRE_domains}{$domain} | |
168 | or return; # nothing found | |
169 | ||
170 | for my $pot (@$pots) | |
171 | { $pot->updated; | |
172 | $pot->write; | |
173 | } | |
174 | ||
175 | $self; | |
176 | } | |
177 | ||
178 | sub DESTROY() {shift->write} | |
179 | ||
180 | sub _reset($$) | |
181 | { my ($self, $domain, $fn) = @_; | |
182 | ||
183 | my $pots = $self->{LRE_domains}{$domain} | |
184 | ||= $self->_read_pots($domain); | |
185 | ||
186 | $_->removeReferencesTo($fn) for @$pots; | |
187 | } | |
188 | ||
189 | sub _read_pots($) | |
190 | { my ($self, $domain) = @_; | |
191 | ||
192 | my $index = $self->index; | |
193 | my $charset = $self->charset; | |
194 | ||
195 | my @pots = map Log::Report::Lexicon::POT->read($_, charset=> $charset), | |
196 | $index->list($domain); | |
197 | ||
198 | trace __xn "found one pot file for domain {domain}" | |
199 | , "found {_count} pot files for domain {domain}" | |
200 | , @pots, domain => $domain; | |
201 | ||
202 | return \@pots | |
203 | if @pots; | |
204 | ||
205 | # new text-domain found, start template | |
206 | my $fn = $index->addFile("$domain.$charset.po"); | |
207 | info __x"starting new textdomain {domain}, template in {filename}" | |
208 | , domain => $domain, filename => $fn; | |
209 | ||
210 | my $pot = Log::Report::Lexicon::POT->new | |
211 | ( textdomain => $domain | |
212 | , filename => $fn | |
213 | , charset => $charset | |
214 | , version => 0.01 | |
215 | ); | |
216 | ||
217 | [ $pot ]; | |
218 | } | |
219 | ||
220 | =method store DOMAIN, FILENAME, LINENR, MSG, [MSG_PLURAL] | |
221 | Register the existence of a (MSG, MSG_PLURAL) in all POTs of | |
222 | the DOMAIN. | |
223 | =cut | |
224 | ||
225 | sub store($$$$;$) | |
226 | { my ($self, $domain, $fn, $linenr, $msgid, $plural) = @_; | |
227 | ||
228 | foreach my $pot ($self->pots($domain)) | |
229 | { if(my $po = $pot->msgid($msgid)) | |
230 | { $po->addReferences( ["$fn:$linenr"]); | |
231 | $po->plural($plural) if $plural; | |
232 | next; | |
233 | } | |
234 | ||
235 | my $format = $msgid =~ m/\{/ ? 'perl-brace' : 'perl'; | |
236 | my $po = Log::Report::Lexicon::PO->new | |
237 | ( msgid => $msgid | |
238 | , msgid_plural => $plural | |
239 | , fuzzy => 1 | |
240 | , format => $format | |
241 | , references => [ "$fn:$linenr" ] | |
242 | ); | |
243 | ||
244 | $pot->add($po); | |
245 | } | |
246 | } | |
247 | ||
248 | 1; |
167 | 167 | The EXTENSION filter can be used to reduce the filenames further, for |
168 | 168 | instance to select only C<po> or only C<mo> files, and ignore readme's. |
169 | 169 | Use an string, without dot and interpreted case-insensitive, or a |
170 | regular expresion. | |
170 | regular expression. | |
171 | 171 | |
172 | 172 | =example |
173 | 173 | my @l = $index->list('my-domain'); |
180 | 180 | my $domain = lc shift; |
181 | 181 | my $filter = shift; |
182 | 182 | my $index = $self->index; |
183 | ||
184 | my @list = | |
185 | map { $index->{$_} } | |
186 | grep { m! \b\Q$domain\E\b !x } | |
187 | keys %$index; | |
183 | my @list = map $index->{$_}, grep m!\b\Q$domain\E\b!, keys %$index; | |
188 | 184 | |
189 | 185 | defined $filter |
190 | 186 | or return @list; |
192 | 188 | $filter = qr/\.\Q$filter\E$/i |
193 | 189 | if defined $filter && ref $filter ne 'Regexp'; |
194 | 190 | |
195 | grep { $_ =~ $filter } @list; | |
191 | grep $_ =~ $filter, @list; | |
196 | 192 | } |
197 | 193 | |
198 | 194 | =chapter DETAILS |
45 | 45 | |
46 | 46 | =option automatic PARAGRAPH |
47 | 47 | =default automatic "" |
48 | Automaticly added comments. | |
48 | Automatically added comments. | |
49 | 49 | See M<addAutomatic()>. |
50 | 50 | |
51 | 51 | =option references STRING|ARRAY-OF-LOCATIONS |
94 | 94 | category of the message. |
95 | 95 | |
96 | 96 | One message can be part of multiple classes. The STRING is used as |
97 | comma- and/or blank seperated list of class tokens, the ARRAY lists all | |
98 | tokens seperately. See M<classes()>. | |
97 | comma- and/or blank separated list of class tokens, the ARRAY lists all | |
98 | tokens separately. See M<classes()>. | |
99 | 99 | |
100 | 100 | =option _classes STRING|ARRAY |
101 | 101 | =default _classes [] |
26 | 26 | |
27 | 27 | =chapter DESCRIPTION |
28 | 28 | A module (or distribution) has a certain way of translating messages, |
29 | usually C<gettext>. The translator is based on the C<textdomain> | |
29 | usually C<gettext>. The translator is based on some C<textdomain> | |
30 | 30 | for the message, which can be specified as option per text element, |
31 | 31 | but usually is package scoped. |
32 | 32 |
7 | 7 | our @EXPORT = qw/@reasons %reason_code |
8 | 8 | parse_locale expand_reasons escape_chars unescape_chars/; |
9 | 9 | |
10 | use Log::Report 'log-report', syntax => 'SHORT'; | |
10 | use Log::Report 'log-report'; | |
11 | 11 | |
12 | 12 | # ordered! |
13 | 13 | our @reasons = N__w('TRACE ASSERT INFO NOTICE WARNING |
3 | 3 | "Project-Id-Version: log-report 0.01\n" |
4 | 4 | "Report-Msgid-Bugs-To:\n" |
5 | 5 | "POT-Creation-Date: 2007-05-14 17:14+0200\n" |
6 | "PO-Revision-Date: 2009-04-27 09:47+0200\n" | |
6 | "PO-Revision-Date: 2012-08-30 21:52+0200\n" | |
7 | 7 | "Last-Translator: Mark Overmeer <mark@overmeer.net>\n" |
8 | 8 | "Language-Team:\n" |
9 | 9 | "MIME-Version: 1.0\n" |
65 | 65 | msgid "PANIC" |
66 | 66 | msgstr "PANIEK" |
67 | 67 | |
68 | #: lib/Log/Report/Extract/PerlPPI.pm:112 | |
68 | #: lib/Log/Report/Extract/PerlPPI.pm:66 | |
69 | 69 | msgid "PPI only supports iso-8859-1 (latin-1) on the moment" |
70 | 70 | msgstr "PPI ondersteunt momenteel alleen iso-8859-1 (latin-1)" |
71 | 71 | |
73 | 73 | msgid "Perl does not support charset {cs}" |
74 | 74 | msgstr "Perl heeft geen support voor tekenset {cs}" |
75 | 75 | |
76 | #: lib/Log/Report/Extract/PerlPPI.pm:67 | |
77 | msgid "PerlPPI requires explicit lexicon directory" | |
78 | msgstr "PerlPPI verwacht een expliciet vermeldde lexicon directory" | |
79 | ||
80 | 76 | #: lib/Log/Report/Util.pm:14 |
81 | 77 | msgid "TRACE" |
82 | 78 | msgstr "TRACE" |
83 | 79 | |
84 | #: lib/Log/Report.pm:225 | |
85 | msgid "Token '{token}' not recognized as reason" | |
86 | msgstr "'{token}' is niet herkend als rapportage reden" | |
87 | ||
88 | 80 | #: lib/Log/Report/Util.pm:14 |
89 | 81 | msgid "WARNING" |
90 | 82 | msgstr "WAARSCHUWING" |
91 | 83 | |
92 | #: lib/Log/Report/Dispatcher.pm:304 lib/Log/Report/Dispatcher.pm:316 | |
84 | #: lib/Log/Report.pm:268 | |
85 | msgid "a message object is reported with more parameters" | |
86 | msgstr "een message object vergezeld van meer parameters" | |
87 | ||
88 | #: lib/Log/Report/Dispatcher.pm:303 lib/Log/Report/Dispatcher.pm:313 | |
93 | 89 | msgid "at {filename} line {line}" |
94 | 90 | msgstr "in {filename} regel {line}" |
95 | 91 | |
96 | #: lib/Log/Report/Extract/PerlPPI.pm:70 | |
92 | #: lib/Log/Report/Extract.pm:50 | |
97 | 93 | msgid "cannot create lexicon directory {dir}" |
98 | 94 | msgstr "kan lexicon map {dir} niet aanmaken" |
95 | ||
96 | #: bin/xgettext-perl:60 | |
97 | msgid "cannot create output directory {dir}" | |
98 | msgstr "uitvoer map {dir} kan niet worden aangemaakt" | |
99 | 99 | |
100 | 100 | #: lib/Log/Report/Dispatcher/Log4perl.pm:121 |
101 | 101 | msgid "cannot find logger '{name}' in configuration {config}" |
102 | 102 | msgstr "kan logger '{name}' in configuratie {config} niet vinden" |
103 | 103 | |
104 | #: lib/Log/Report/Extract/PerlPPI.pm:115 | |
104 | #: bin/xgettext-perl:68 | |
105 | msgid "cannot read filename list from {fn}" | |
106 | msgstr "lijst met filenamen {fn} kan niet worden gelezen" | |
107 | ||
108 | #: lib/Log/Report/Extract/PerlPPI.pm:69 | |
105 | 109 | msgid "cannot read from file {filename}" |
106 | 110 | msgstr "kan bestand {filename} niet lezen" |
107 | 111 | |
109 | 113 | msgid "cannot read in {cs} from file {fn}" |
110 | 114 | msgstr "kan bestand {fn} niet lezen in {cs}" |
111 | 115 | |
112 | #: lib/Log/Report/Dispatcher/File.pm:92 | |
116 | #: lib/Log/Report/Extract/Template.pm:92 | |
117 | msgid "cannot read template from {fn}" | |
118 | msgstr "template {fn} kan niet worden gelezen" | |
119 | ||
120 | #: lib/Log/Report/Dispatcher/File.pm:96 | |
113 | 121 | msgid "cannot write log into {file} with {binmode}" |
114 | 122 | msgstr "kan log niet naar bestand {file} schrijven in {binmode}" |
115 | 123 | |
125 | 133 | msgid "charset parameter required for {fn}" |
126 | 134 | msgstr "" |
127 | 135 | |
128 | #: lib/Log/Report/Dispatcher/File.pm:81 | |
136 | #: lib/Log/Report/Dispatcher/Callback.pm:62 | |
137 | msgid "dispatcher {name} needs a 'callback'" | |
138 | msgstr "dispatcher {name} verlangt een 'callback'" | |
139 | ||
140 | #: lib/Log/Report/Dispatcher/File.pm:85 | |
129 | 141 | msgid "dispatcher {name} needs parameter 'to'" |
130 | msgstr "dispatcher {name} verwacht argument 'to'" | |
131 | ||
132 | #: lib/Log/Report/Extract/PerlPPI.pm:200 | |
142 | msgstr "dispatcher {name} verlangt argument 'to'" | |
143 | ||
144 | #: bin/xgettext-perl:65 | |
145 | msgid "do not combine command-line filenames with --files-from" | |
146 | msgstr "combineer filenamen op de commando-regel niet met --files-from" | |
147 | ||
148 | #: lib/Log/Report/Extract/PerlPPI.pm:170 | |
133 | 149 | msgid "do not interpolate in msgid (found '{var}' in line {line})" |
134 | 150 | msgstr "gebruik geen variabelen in een msgid (vond '{var}' op regel {line'})" |
135 | 151 | |
145 | 161 | "de regel op {where} wordt niet begrepen:\n" |
146 | 162 | " {line}" |
147 | 163 | |
164 | #: lib/Log/Report.pm:654 | |
165 | msgid "even length parameter list for __x at {where}" | |
166 | msgstr "een even-lengte lijst van parameters bij __x bij {where}" | |
167 | ||
168 | #: bin/xgettext-perl:57 | |
169 | msgid "explicit output directory (-p) required" | |
170 | msgstr "expliciete uitvoer map (met -p) verplicht" | |
171 | ||
172 | #: lib/Log/Report/Extract.pm:47 | |
173 | msgid "extractions require an explicit lexicon directory" | |
174 | msgstr "een expliciete lexicon directory is nodig voor de uittreksels" | |
175 | ||
148 | 176 | #: lib/Log/Report/Lexicon/POT.pm:163 lib/Log/Report/Lexicon/POTcompact.pm:106 |
149 | 177 | msgid "failed reading from file {fn}" |
150 | 178 | msgstr "lezen uit bestand {fn} mislukt" |
151 | 179 | |
152 | #: lib/Log/Report/Extract/PerlPPI.pm:322 | |
180 | #: lib/Log/Report/Extract.pm:199 | |
153 | 181 | msgid "found one pot file for domain {domain}" |
154 | 182 | msgid_plural "found {_count} pot files for domain {domain}" |
155 | 183 | msgstr[0] "één pot bestand voor domein {domain} gevonden" |
159 | 187 | msgid "illegal format_reason '{format}' for dispatcher" |
160 | 188 | msgstr "onbekende format_reason '{format}' voor dispatcher" |
161 | 189 | |
162 | #~ msgid "in SCALAR context, only one dispatcher name accepted" | |
163 | #~ msgstr "in SCALAR context kan slechts één dispatcher naam worden gebruikt" | |
164 | ||
165 | 190 | #: lib/Log/Report/Lexicon/POTcompact.pm:182 |
166 | 191 | msgid "invalid plural-form algorithm '{alg}'" |
167 | 192 | msgstr "incorrect meervoudsvorm algoritme '{alg}'" |
168 | 193 | |
169 | #: lib/Log/Report/Extract/PerlPPI.pm:218 | |
194 | #: lib/Log/Report/Exception.pm:102 | |
195 | msgid "message() of exception expects Log::Report::Message" | |
196 | msgstr "message() van een exception verwacht een Log::Report::Message" | |
197 | ||
198 | #: lib/Log/Report/Extract/Template.pm:102 | |
199 | msgid "need pattern to scan for, either via new() or process()" | |
200 | msgstr "een scan pattern is nodig, via new() of process()" | |
201 | ||
202 | #: lib/Log/Report/Extract/PerlPPI.pm:188 | |
170 | 203 | msgid "new-line is added automatically (found in line {line})" |
171 | 204 | msgstr "een regel-overgang wordt automatisch toegevoegd (gevonden op regel {line})" |
205 | ||
206 | #: lib/Log/Report/Extract/PerlPPI.pm:73 | |
207 | #, fuzzy | |
208 | msgid "no Perl in file {filename}" | |
209 | msgstr "" | |
172 | 210 | |
173 | 211 | #: lib/Log/Report/Lexicon/POT.pm:187 |
174 | 212 | msgid "no filename or file-handle specified for PO" |
186 | 224 | msgid "no plurals for '{msgid}'" |
187 | 225 | msgstr "geen meervoudsvormen voor '{msgid}'" |
188 | 226 | |
189 | #: lib/Log/Report/Extract/PerlPPI.pm:155 | |
190 | msgid "no textdomain for translatable at {fn} line {line}" | |
191 | msgstr "geen textdomain voor vertaling in {fn} regel {line}" | |
192 | ||
193 | #: lib/Log/Report.pm:489 | |
227 | #: lib/Log/Report/Extract/PerlPPI.pm:121 | |
228 | msgid "no text-domain for translatable at {fn} line {line}" | |
229 | msgstr "geen text-domain voor vertaalbare string in {fn} regel {line}" | |
230 | ||
231 | #: lib/Log/Report.pm:505 | |
194 | 232 | msgid "odd length parameter list for try(): forgot the terminating ';'?" |
195 | 233 | msgstr "oneven lengte van parameterlijst voor try(): afsluitende ';' vergeten?" |
196 | 234 | |
197 | #: lib/Log/Report.pm:416 | |
235 | #: lib/Log/Report.pm:276 | |
236 | msgid "odd length parameter list with '{msg}'" | |
237 | msgstr "parameter-lijst van oneven lengte bij '{msg}'" | |
238 | ||
239 | #: lib/Log/Report.pm:432 | |
198 | 240 | msgid "only one dispatcher name accepted in SCALAR context" |
199 | 241 | msgstr "dispatcher gebruik in SCALAR context accepteert slechts één naam" |
200 | 242 | |
201 | #: lib/Log/Report.pm:914 | |
243 | #: lib/Log/Report.pm:939 | |
202 | 244 | msgid "only one package can contain configuration; for {domain} already in {pkg} in file {fn} line {line}" |
203 | 245 | msgstr "slechts één package mag configuratie informatie bevatten; voor {domain} is dit al gevonden in {pkg}, bestand {fn} regel {line}" |
204 | 246 | |
205 | #: lib/Log/Report/Extract/PerlPPI.pm:109 | |
247 | #: lib/Log/Report/Extract/PerlPPI.pm:77 lib/Log/Report/Extract/Template.pm:87 | |
206 | 248 | msgid "processing file {fn} in {charset}" |
207 | 249 | msgstr "verwerk bestand {fn} in {charset}" |
250 | ||
251 | #: bin/xgettext-perl:54 | |
252 | msgid "programming language {lang} not supported" | |
253 | msgstr "programmeertaal {lang} wordt niet ondersteund" | |
208 | 254 | |
209 | 255 | #: lib/Log/Report/Lexicon/PO.pm:360 |
210 | 256 | msgid "quoted line is not a continuation at {where}" |
218 | 264 | msgid "reason '{begin}' more serious than '{end}' in '{reasons}" |
219 | 265 | msgstr "reden '{begin}' is serieuzer dan '{end}' in '{reasons}'" |
220 | 266 | |
221 | #: lib/Log/Report/Extract/PerlPPI.pm:330 | |
267 | #: lib/Log/Report/Extract/Template.pm:186 | |
268 | msgid "scan pattern `{pattern}' not recognized" | |
269 | msgstr "scan patroon `{pattern}' wordt niet herkend" | |
270 | ||
271 | #: lib/Log/Report/Extract.pm:208 | |
222 | 272 | msgid "starting new textdomain {domain}, template in {filename}" |
223 | 273 | msgstr "begin van nieuw textdomain {domain}, sjabloon in {filename}" |
224 | 274 | |
226 | 276 | msgid "string '{text}' not between quotes at {location}" |
227 | 277 | msgstr "tekst '{text}' niet tussen quotes in {location}" |
228 | 278 | |
229 | #: lib/Log/Report/Extract/PerlPPI.pm:208 | |
279 | #: lib/Log/Report/Extract/PerlPPI.pm:178 | |
230 | 280 | msgid "string is incorrect at line {line}: {error}" |
231 | 281 | msgstr "foutieve string in regel {regel}: {error}" |
232 | 282 | |
234 | 284 | msgid "switching to run mode {mode}, accept {accept}" |
235 | 285 | msgstr "verwerkingsmode {mode}, accepteert {accept}" |
236 | 286 | |
237 | #: lib/Log/Report.pm:842 | |
287 | #: lib/Log/Report.pm:867 | |
238 | 288 | msgid "syntax flag must be either SHORT or REPORT, not `{syntax}'" |
239 | 289 | msgstr "syntax parameter moet zijn SHORT of REPORT, niet `{syntax}'" |
240 | 290 | |
242 | 292 | msgid "syslog level '{level}' not understood" |
243 | 293 | msgstr "syslog level '{level}' niet herkend" |
244 | 294 | |
245 | #: lib/Log/Report.pm:882 | |
295 | #: lib/Log/Report.pm:907 | |
246 | 296 | msgid "textdomain for translator not defined" |
247 | 297 | msgstr "tekstdomein voor vertaler niet gedefinieerd" |
248 | 298 | |
250 | 300 | msgid "textdomain parameter is required" |
251 | 301 | msgstr "tekstdomain argument is verplicht" |
252 | 302 | |
253 | #: lib/Log/Report.pm:402 | |
303 | #: lib/Log/Report.pm:417 | |
254 | 304 | msgid "the 'filter' sub-command needs a CODE reference" |
255 | 305 | msgstr "het 'filter' sub-commando verwacht een CODE referentie" |
256 | 306 | |
257 | #: lib/Log/Report.pm:389 | |
307 | #: lib/Log/Report.pm:404 | |
258 | 308 | msgid "the 'list' sub-command doesn't expect additional parameters" |
259 | 309 | msgstr "het 'list' sub-commando verwacht geen aanvullende argumenten" |
260 | 310 | |
261 | #: lib/Log/Report.pm:395 | |
311 | #: lib/Log/Report.pm:410 | |
262 | 312 | msgid "the 'needs' sub-command parameter '{reason}' is not a reason" |
263 | 313 | msgstr "het 'needs' sub-commando argument '{reason}' is geen reden" |
264 | 314 | |
266 | 316 | msgid "the only acceptable parameter is 'ACTIVE', not '{p}'" |
267 | 317 | msgstr "het enige geaccepteerde argument is 'ACTIVE', niet '{p}'" |
268 | 318 | |
319 | #: lib/Log/Report.pm:245 | |
320 | msgid "token '{token}' not recognized as reason" | |
321 | msgstr "token '{token}' niet herkend als reden" | |
322 | ||
269 | 323 | #: lib/Log/Report/Lexicon/PO.pm:435 |
270 | 324 | msgid "too many plurals for '{msgid}'" |
271 | 325 | msgstr "te veel meervouden voor '{msgid}'" |
274 | 328 | msgid "translation already exists for '{msgid}'" |
275 | 329 | msgstr "er bestaat al een vertaling voor '{msgid}'" |
276 | 330 | |
277 | #: lib/Log/Report.pm:889 | |
331 | #: lib/Log/Report.pm:914 | |
278 | 332 | msgid "translator must be a Log::Report::Translator object" |
279 | 333 | msgstr "vertaler moet een Log::Report::Translator object zijn" |
280 | 334 | |
281 | #: lib/Log/Report/Dispatcher/Try.pm:216 | |
335 | #: lib/Log/Report/Dispatcher/Try.pm:220 | |
282 | 336 | msgid "try-block stopped with {reason}: {text}" |
283 | 337 | msgstr "try-blok gestopt met {reason}: {text}" |
284 | 338 | |
306 | 360 | msgid "unnamed file" |
307 | 361 | msgstr "naamloze file" |
308 | 362 | |
309 | #: lib/Log/Report.pm:919 | |
363 | #: lib/Log/Report.pm:944 | |
310 | 364 | msgid "value for {name} specified twice" |
311 | 365 | msgstr "twee keer een waarde voor {name}" |
312 | 366 | |
314 | 368 | msgid "write errors for file {fn}" |
315 | 369 | msgstr "schrijfproblemen bij bestand {fn}" |
316 | 370 | |
317 | #: lib/Log/Report/Extract/PerlPPI.pm:270 | |
371 | #: lib/Log/Report/Extract.pm:146 | |
318 | 372 | msgid "{domain}: one file with {ids} msgids" |
319 | 373 | msgid_plural "{domain}: {_count} files with each {ids} msgids" |
320 | 374 | msgstr[0] "{domain}: één bestand met {ids} mgsids" |
321 | 375 | msgstr[1] "{domain}: {_count} bestanden met elk {ids} msgids" |
322 | 376 | |
323 | #: lib/Log/Report/Extract/PerlPPI.pm:263 | |
377 | #: lib/Log/Report/Extract.pm:139 | |
324 | 378 | msgid "{domain}: one file with {ids} msgids, {f} fuzzy and {i} inactive translations" |
325 | 379 | msgid_plural "{domain}: {_count} files each {ids} msgids, {f} fuzzy and {i} inactive translations in total" |
326 | 380 | msgstr[0] "{domain}: één bestand met {ids} mgsids, {f} fuzzy en {i} op non-actief" |
327 | 381 | msgstr[1] "{domain}: {_count} bestanden met elk {ids} msgids, {f} fuzzy en {i} op non-actief in het totaal" |
328 | 382 | |
329 | #: lib/Log/Report/Extract/PerlPPI.pm:253 | |
383 | #: lib/Log/Report/Extract.pm:129 | |
330 | 384 | msgid "{domain}: {fuzzy%3d} fuzzy, {inact%3d} inactive in {filename}" |
331 | 385 | msgstr "{domain}: {fuzzy%3d} fuzzy, {inact%3d} op non-actief in {filename}" |
332 | 386 |
3 | 3 | "Project-Id-Version: log-report 0.01\n" |
4 | 4 | "Report-Msgid-Bugs-To:\n" |
5 | 5 | "POT-Creation-Date: 2007-05-14 17:14+0200\n" |
6 | "PO-Revision-Date: 2009-04-27 09:47+0200\n" | |
6 | "PO-Revision-Date: 2012-08-30 21:52+0200\n" | |
7 | 7 | "Last-Translator:\n" |
8 | 8 | "Language-Team:\n" |
9 | 9 | "MIME-Version: 1.0\n" |
80 | 80 | msgid "PANIC" |
81 | 81 | msgstr "" |
82 | 82 | |
83 | #: lib/Log/Report/Extract/PerlPPI.pm:112 | |
83 | #: lib/Log/Report/Extract/PerlPPI.pm:66 | |
84 | 84 | #, fuzzy |
85 | 85 | msgid "PPI only supports iso-8859-1 (latin-1) on the moment" |
86 | 86 | msgstr "" |
90 | 90 | msgid "Perl does not support charset {cs}" |
91 | 91 | msgstr "" |
92 | 92 | |
93 | #: lib/Log/Report/Extract/PerlPPI.pm:67 | |
94 | #, fuzzy | |
95 | msgid "PerlPPI requires explicit lexicon directory" | |
96 | msgstr "" | |
97 | ||
98 | 93 | #: lib/Log/Report/Util.pm:14 |
99 | 94 | #, fuzzy |
100 | 95 | msgid "TRACE" |
101 | 96 | msgstr "" |
102 | 97 | |
103 | #: lib/Log/Report.pm:225 | |
104 | #, fuzzy | |
105 | msgid "Token '{token}' not recognized as reason" | |
106 | msgstr "" | |
107 | ||
108 | 98 | #: lib/Log/Report/Util.pm:14 |
109 | 99 | #, fuzzy |
110 | 100 | msgid "WARNING" |
111 | 101 | msgstr "" |
112 | 102 | |
113 | #: lib/Log/Report/Dispatcher.pm:304 lib/Log/Report/Dispatcher.pm:316 | |
103 | #: lib/Log/Report.pm:268 | |
104 | #, fuzzy | |
105 | msgid "a message object is reported with more parameters" | |
106 | msgstr "" | |
107 | ||
108 | #: lib/Log/Report/Dispatcher.pm:303 lib/Log/Report/Dispatcher.pm:313 | |
114 | 109 | #, fuzzy |
115 | 110 | msgid "at {filename} line {line}" |
116 | 111 | msgstr "" |
117 | 112 | |
118 | #: lib/Log/Report/Extract/PerlPPI.pm:70 | |
113 | #: lib/Log/Report/Extract.pm:50 | |
119 | 114 | #, fuzzy |
120 | 115 | msgid "cannot create lexicon directory {dir}" |
121 | 116 | msgstr "" |
122 | 117 | |
118 | #: bin/xgettext-perl:60 | |
119 | #, fuzzy | |
120 | msgid "cannot create output directory {dir}" | |
121 | msgstr "" | |
122 | ||
123 | 123 | #: lib/Log/Report/Dispatcher/Log4perl.pm:121 |
124 | 124 | #, fuzzy |
125 | 125 | msgid "cannot find logger '{name}' in configuration {config}" |
126 | 126 | msgstr "" |
127 | 127 | |
128 | #: lib/Log/Report/Extract/PerlPPI.pm:115 | |
128 | #: bin/xgettext-perl:68 | |
129 | #, fuzzy | |
130 | msgid "cannot read filename list from {fn}" | |
131 | msgstr "" | |
132 | ||
133 | #: lib/Log/Report/Extract/PerlPPI.pm:69 | |
129 | 134 | #, fuzzy |
130 | 135 | msgid "cannot read from file {filename}" |
131 | 136 | msgstr "" |
135 | 140 | msgid "cannot read in {cs} from file {fn}" |
136 | 141 | msgstr "" |
137 | 142 | |
138 | #: lib/Log/Report/Dispatcher/File.pm:92 | |
143 | #: lib/Log/Report/Extract/Template.pm:92 | |
144 | #, fuzzy | |
145 | msgid "cannot read template from {fn}" | |
146 | msgstr "" | |
147 | ||
148 | #: lib/Log/Report/Dispatcher/File.pm:96 | |
139 | 149 | #, fuzzy |
140 | 150 | msgid "cannot write log into {file} with {binmode}" |
141 | 151 | msgstr "" |
155 | 165 | msgid "charset parameter required for {fn}" |
156 | 166 | msgstr "" |
157 | 167 | |
158 | #: lib/Log/Report/Dispatcher/File.pm:81 | |
168 | #: lib/Log/Report/Dispatcher/Callback.pm:62 | |
169 | #, fuzzy | |
170 | msgid "dispatcher {name} needs a 'callback'" | |
171 | msgstr "" | |
172 | ||
173 | #: lib/Log/Report/Dispatcher/File.pm:85 | |
159 | 174 | #, fuzzy |
160 | 175 | msgid "dispatcher {name} needs parameter 'to'" |
161 | 176 | msgstr "" |
162 | 177 | |
163 | #: lib/Log/Report/Extract/PerlPPI.pm:200 | |
178 | #: bin/xgettext-perl:65 | |
179 | #, fuzzy | |
180 | msgid "do not combine command-line filenames with --files-from" | |
181 | msgstr "" | |
182 | ||
183 | #: lib/Log/Report/Extract/PerlPPI.pm:170 | |
164 | 184 | #, fuzzy |
165 | 185 | msgid "do not interpolate in msgid (found '{var}' in line {line})" |
166 | 186 | msgstr "" |
177 | 197 | " {line}" |
178 | 198 | msgstr "" |
179 | 199 | |
200 | #: lib/Log/Report.pm:654 | |
201 | #, fuzzy | |
202 | msgid "even length parameter list for __x at {where}" | |
203 | msgstr "" | |
204 | ||
205 | #: bin/xgettext-perl:57 | |
206 | #, fuzzy | |
207 | msgid "explicit output directory (-p) required" | |
208 | msgstr "" | |
209 | ||
210 | #: lib/Log/Report/Extract.pm:47 | |
211 | #, fuzzy | |
212 | msgid "extractions require an explicit lexicon directory" | |
213 | msgstr "" | |
214 | ||
180 | 215 | #: lib/Log/Report/Lexicon/POT.pm:163 lib/Log/Report/Lexicon/POTcompact.pm:106 |
181 | 216 | #, fuzzy |
182 | 217 | msgid "failed reading from file {fn}" |
183 | 218 | msgstr "" |
184 | 219 | |
185 | #: lib/Log/Report/Extract/PerlPPI.pm:322 | |
220 | #: lib/Log/Report/Extract.pm:199 | |
186 | 221 | #, fuzzy |
187 | 222 | msgid "found one pot file for domain {domain}" |
188 | 223 | msgid_plural "found {_count} pot files for domain {domain}" |
199 | 234 | msgid "invalid plural-form algorithm '{alg}'" |
200 | 235 | msgstr "" |
201 | 236 | |
202 | #: lib/Log/Report/Extract/PerlPPI.pm:218 | |
237 | #: lib/Log/Report/Exception.pm:102 | |
238 | #, fuzzy | |
239 | msgid "message() of exception expects Log::Report::Message" | |
240 | msgstr "" | |
241 | ||
242 | #: lib/Log/Report/Extract/Template.pm:102 | |
243 | #, fuzzy | |
244 | msgid "need pattern to scan for, either via new() or process()" | |
245 | msgstr "" | |
246 | ||
247 | #: lib/Log/Report/Extract/PerlPPI.pm:188 | |
203 | 248 | #, fuzzy |
204 | 249 | msgid "new-line is added automatically (found in line {line})" |
205 | 250 | msgstr "" |
206 | 251 | |
252 | #: lib/Log/Report/Extract/PerlPPI.pm:73 | |
253 | #, fuzzy | |
254 | msgid "no Perl in file {filename}" | |
255 | msgstr "" | |
256 | ||
207 | 257 | #: lib/Log/Report/Lexicon/POT.pm:187 |
208 | 258 | #, fuzzy |
209 | 259 | msgid "no filename or file-handle specified for PO" |
224 | 274 | msgid "no plurals for '{msgid}'" |
225 | 275 | msgstr "" |
226 | 276 | |
227 | #: lib/Log/Report/Extract/PerlPPI.pm:155 | |
228 | #, fuzzy | |
229 | msgid "no textdomain for translatable at {fn} line {line}" | |
230 | msgstr "" | |
231 | ||
232 | #: lib/Log/Report.pm:489 | |
277 | #: lib/Log/Report/Extract/PerlPPI.pm:121 | |
278 | #, fuzzy | |
279 | msgid "no text-domain for translatable at {fn} line {line}" | |
280 | msgstr "" | |
281 | ||
282 | #: lib/Log/Report.pm:505 | |
233 | 283 | #, fuzzy |
234 | 284 | msgid "odd length parameter list for try(): forgot the terminating ';'?" |
235 | 285 | msgstr "" |
236 | 286 | |
237 | #: lib/Log/Report.pm:416 | |
287 | #: lib/Log/Report.pm:276 | |
288 | #, fuzzy | |
289 | msgid "odd length parameter list with '{msg}'" | |
290 | msgstr "" | |
291 | ||
292 | #: lib/Log/Report.pm:432 | |
238 | 293 | #, fuzzy |
239 | 294 | msgid "only one dispatcher name accepted in SCALAR context" |
240 | 295 | msgstr "" |
241 | 296 | |
297 | #: lib/Log/Report.pm:939 | |
298 | #, fuzzy | |
299 | msgid "only one package can contain configuration; for {domain} already in {pkg} in file {fn} line {line}" | |
300 | msgstr "" | |
301 | ||
302 | #: lib/Log/Report/Extract/PerlPPI.pm:77 lib/Log/Report/Extract/Template.pm:87 | |
303 | #, fuzzy | |
304 | msgid "processing file {fn} in {charset}" | |
305 | msgstr "" | |
306 | ||
307 | #: bin/xgettext-perl:54 | |
308 | #, fuzzy | |
309 | msgid "programming language {lang} not supported" | |
310 | msgstr "" | |
311 | ||
312 | #: lib/Log/Report/Lexicon/PO.pm:360 | |
313 | #, fuzzy | |
314 | msgid "quoted line is not a continuation at {where}" | |
315 | msgstr "" | |
316 | ||
317 | #: lib/Log/Report/Translator/POT.pm:85 | |
318 | #, fuzzy | |
319 | msgid "read pot-file {filename} for {domain} in {locale}" | |
320 | msgstr "" | |
321 | ||
322 | #: lib/Log/Report/Util.pm:136 | |
323 | #, fuzzy | |
324 | msgid "reason '{begin}' more serious than '{end}' in '{reasons}" | |
325 | msgstr "" | |
326 | ||
327 | #: lib/Log/Report/Extract/Template.pm:186 | |
328 | #, fuzzy | |
329 | msgid "scan pattern `{pattern}' not recognized" | |
330 | msgstr "" | |
331 | ||
332 | #: lib/Log/Report/Extract.pm:208 | |
333 | #, fuzzy | |
334 | msgid "starting new textdomain {domain}, template in {filename}" | |
335 | msgstr "" | |
336 | ||
337 | #: lib/Log/Report/Lexicon/POTcompact.pm:194 | |
338 | #, fuzzy | |
339 | msgid "string '{text}' not between quotes at {location}" | |
340 | msgstr "" | |
341 | ||
342 | #: lib/Log/Report/Extract/PerlPPI.pm:178 | |
343 | #, fuzzy | |
344 | msgid "string is incorrect at line {line}: {error}" | |
345 | msgstr "" | |
346 | ||
347 | #: lib/Log/Report/Dispatcher.pm:215 | |
348 | #, fuzzy | |
349 | msgid "switching to run mode {mode}, accept {accept}" | |
350 | msgstr "" | |
351 | ||
352 | #: lib/Log/Report.pm:867 | |
353 | #, fuzzy | |
354 | msgid "syntax flag must be either SHORT or REPORT, not `{syntax}'" | |
355 | msgstr "" | |
356 | ||
357 | #: lib/Log/Report/Dispatcher/Syslog.pm:122 | |
358 | #, fuzzy | |
359 | msgid "syslog level '{level}' not understood" | |
360 | msgstr "" | |
361 | ||
362 | #: lib/Log/Report.pm:907 | |
363 | #, fuzzy | |
364 | msgid "textdomain for translator not defined" | |
365 | msgstr "" | |
366 | ||
367 | #: lib/Log/Report/Lexicon/POT.pm:112 | |
368 | #, fuzzy | |
369 | msgid "textdomain parameter is required" | |
370 | msgstr "" | |
371 | ||
372 | #: lib/Log/Report.pm:417 | |
373 | #, fuzzy | |
374 | msgid "the 'filter' sub-command needs a CODE reference" | |
375 | msgstr "" | |
376 | ||
377 | #: lib/Log/Report.pm:404 | |
378 | #, fuzzy | |
379 | msgid "the 'list' sub-command doesn't expect additional parameters" | |
380 | msgstr "" | |
381 | ||
382 | #: lib/Log/Report.pm:410 | |
383 | #, fuzzy | |
384 | msgid "the 'needs' sub-command parameter '{reason}' is not a reason" | |
385 | msgstr "" | |
386 | ||
387 | #: lib/Log/Report/Lexicon/POT.pm:286 | |
388 | #, fuzzy | |
389 | msgid "the only acceptable parameter is 'ACTIVE', not '{p}'" | |
390 | msgstr "" | |
391 | ||
392 | #: lib/Log/Report.pm:245 | |
393 | #, fuzzy | |
394 | msgid "token '{token}' not recognized as reason" | |
395 | msgstr "" | |
396 | ||
397 | #: lib/Log/Report/Lexicon/PO.pm:435 | |
398 | #, fuzzy | |
399 | msgid "too many plurals for '{msgid}'" | |
400 | msgstr "" | |
401 | ||
402 | #: lib/Log/Report/Lexicon/POT.pm:269 | |
403 | #, fuzzy | |
404 | msgid "translation already exists for '{msgid}'" | |
405 | msgstr "" | |
406 | ||
242 | 407 | #: lib/Log/Report.pm:914 |
243 | 408 | #, fuzzy |
244 | msgid "only one package can contain configuration; for {domain} already in {pkg} in file {fn} line {line}" | |
245 | msgstr "" | |
246 | ||
247 | #: lib/Log/Report/Extract/PerlPPI.pm:109 | |
248 | #, fuzzy | |
249 | msgid "processing file {fn} in {charset}" | |
250 | msgstr "" | |
251 | ||
252 | #: lib/Log/Report/Lexicon/PO.pm:360 | |
253 | #, fuzzy | |
254 | msgid "quoted line is not a continuation at {where}" | |
255 | msgstr "" | |
256 | ||
257 | #: lib/Log/Report/Translator/POT.pm:85 | |
258 | #, fuzzy | |
259 | msgid "read pot-file {filename} for {domain} in {locale}" | |
260 | msgstr "" | |
261 | ||
262 | #: lib/Log/Report/Util.pm:136 | |
263 | #, fuzzy | |
264 | msgid "reason '{begin}' more serious than '{end}' in '{reasons}" | |
265 | msgstr "" | |
266 | ||
267 | #: lib/Log/Report/Extract/PerlPPI.pm:330 | |
268 | #, fuzzy | |
269 | msgid "starting new textdomain {domain}, template in {filename}" | |
270 | msgstr "" | |
271 | ||
272 | #: lib/Log/Report/Lexicon/POTcompact.pm:194 | |
273 | #, fuzzy | |
274 | msgid "string '{text}' not between quotes at {location}" | |
275 | msgstr "" | |
276 | ||
277 | #: lib/Log/Report/Extract/PerlPPI.pm:208 | |
278 | #, fuzzy | |
279 | msgid "string is incorrect at line {line}: {error}" | |
280 | msgstr "" | |
281 | ||
282 | #: lib/Log/Report/Dispatcher.pm:215 | |
283 | #, fuzzy | |
284 | msgid "switching to run mode {mode}, accept {accept}" | |
285 | msgstr "" | |
286 | ||
287 | #: lib/Log/Report.pm:842 | |
288 | #, fuzzy | |
289 | msgid "syntax flag must be either SHORT or REPORT, not `{syntax}'" | |
290 | msgstr "" | |
291 | ||
292 | #: lib/Log/Report/Dispatcher/Syslog.pm:122 | |
293 | #, fuzzy | |
294 | msgid "syslog level '{level}' not understood" | |
295 | msgstr "" | |
296 | ||
297 | #: lib/Log/Report.pm:882 | |
298 | #, fuzzy | |
299 | msgid "textdomain for translator not defined" | |
300 | msgstr "" | |
301 | ||
302 | #: lib/Log/Report/Lexicon/POT.pm:112 | |
303 | #, fuzzy | |
304 | msgid "textdomain parameter is required" | |
305 | msgstr "" | |
306 | ||
307 | #: lib/Log/Report.pm:402 | |
308 | #, fuzzy | |
309 | msgid "the 'filter' sub-command needs a CODE reference" | |
310 | msgstr "" | |
311 | ||
312 | #: lib/Log/Report.pm:389 | |
313 | #, fuzzy | |
314 | msgid "the 'list' sub-command doesn't expect additional parameters" | |
315 | msgstr "" | |
316 | ||
317 | #: lib/Log/Report.pm:395 | |
318 | #, fuzzy | |
319 | msgid "the 'needs' sub-command parameter '{reason}' is not a reason" | |
320 | msgstr "" | |
321 | ||
322 | #: lib/Log/Report/Lexicon/POT.pm:286 | |
323 | #, fuzzy | |
324 | msgid "the only acceptable parameter is 'ACTIVE', not '{p}'" | |
325 | msgstr "" | |
326 | ||
327 | #: lib/Log/Report/Lexicon/PO.pm:435 | |
328 | #, fuzzy | |
329 | msgid "too many plurals for '{msgid}'" | |
330 | msgstr "" | |
331 | ||
332 | #: lib/Log/Report/Lexicon/POT.pm:269 | |
333 | #, fuzzy | |
334 | msgid "translation already exists for '{msgid}'" | |
335 | msgstr "" | |
336 | ||
337 | #: lib/Log/Report.pm:889 | |
338 | #, fuzzy | |
339 | 409 | msgid "translator must be a Log::Report::Translator object" |
340 | 410 | msgstr "" |
341 | 411 | |
342 | #: lib/Log/Report/Dispatcher/Try.pm:216 | |
412 | #: lib/Log/Report/Dispatcher/Try.pm:220 | |
343 | 413 | #, fuzzy |
344 | 414 | msgid "try-block stopped with {reason}: {text}" |
345 | 415 | msgstr "" |
374 | 444 | msgid "unnamed file" |
375 | 445 | msgstr "" |
376 | 446 | |
377 | #: lib/Log/Report.pm:919 | |
447 | #: lib/Log/Report.pm:944 | |
378 | 448 | #, fuzzy |
379 | 449 | msgid "value for {name} specified twice" |
380 | 450 | msgstr "" |
384 | 454 | msgid "write errors for file {fn}" |
385 | 455 | msgstr "" |
386 | 456 | |
387 | #: lib/Log/Report/Extract/PerlPPI.pm:270 | |
457 | #: lib/Log/Report/Extract.pm:146 | |
388 | 458 | #, fuzzy |
389 | 459 | msgid "{domain}: one file with {ids} msgids" |
390 | 460 | msgid_plural "{domain}: {_count} files with each {ids} msgids" |
391 | 461 | msgstr[0] "" |
392 | 462 | msgstr[1] "" |
393 | 463 | |
394 | #: lib/Log/Report/Extract/PerlPPI.pm:263 | |
464 | #: lib/Log/Report/Extract.pm:139 | |
395 | 465 | #, fuzzy |
396 | 466 | msgid "{domain}: one file with {ids} msgids, {f} fuzzy and {i} inactive translations" |
397 | 467 | msgid_plural "{domain}: {_count} files each {ids} msgids, {f} fuzzy and {i} inactive translations in total" |
398 | 468 | msgstr[0] "" |
399 | 469 | msgstr[1] "" |
400 | 470 | |
401 | #: lib/Log/Report/Extract/PerlPPI.pm:253 | |
471 | #: lib/Log/Report/Extract.pm:129 | |
402 | 472 | #, fuzzy |
403 | 473 | msgid "{domain}: {fuzzy%3d} fuzzy, {inact%3d} inactive in {filename}" |
404 | 474 | msgstr "" |
52 | 52 | dispatcher PERL => 'default', accept => 'NOTICE-'; |
53 | 53 | |
54 | 54 | =chapter NAME |
55 | Log::Report - report a problem, pluggable handlers and language support | |
55 | Log::Report - report a problem, with exceptions and language support | |
56 | 56 | |
57 | 57 | =chapter SYNOPSIS |
58 | # Read section "The Reason for the report" first!!! | |
59 | ||
60 | # In each package, declare a name-space. Different packages | |
61 | # used by one program can have different translation tables. | |
58 | # Invocation with mode helps debugging | |
59 | use Log::Report mode => 'DEBUG'; | |
60 | ||
61 | -f $config or panic "Help!"; # alert/error/fault/info/...more | |
62 | error "oops"; # like die(), no translation | |
63 | ||
64 | # Provide a name-space to use translation tables. Like Locale::TextDomain | |
62 | 65 | use Log::Report 'my-domain'; |
63 | ||
64 | # Many destinations in parallel possible. Log::Report::Dispatcher | |
65 | dispatcher PERL => 'default' | |
66 | , reasons => 'NOTICE-'; # this disp. is automatically added | |
67 | ||
68 | dispatcher SYSLOG => 'syslog' | |
69 | , charset => 'iso-8859-1' # explicit conversions | |
70 | , locale => 'en_US'; # overrule user's locale | |
71 | ||
72 | # Produce an error, long syntax | |
66 | error __x"Help!"; # __x() handles translation | |
67 | print __x"my name is {name}", name => $fullname; | |
68 | print __x'Hello World'; # ERROR!! ' is alternative for :: | |
69 | ||
70 | # Many destinations for message in parallel possible. | |
71 | dispatcher PERL => 'default' # See Log::Report::Dispatcher: use die/warn | |
72 | , reasons => 'NOTICE-'; # this disp. is already present at start | |
73 | ||
74 | dispatcher SYSLOG => 'syslog'# also send to syslog | |
75 | , charset => 'iso-8859-1' # explicit character conversions | |
76 | , locale => 'en_US'; # overrule user's locale | |
77 | ||
78 | dispatcher close => 'PERL'; # stop dispatching to die/warn | |
79 | ||
80 | # Produce an error, long syntax (rarely used) | |
73 | 81 | report ERROR => __x('gettext string', param => $param, ...) |
74 | 82 | if $condition; |
75 | 83 | |
76 | # when syntax=SHORT (default since 0.26), many useful functions | |
84 | # When syntax=SHORT (default since 0.26) | |
77 | 85 | error __x('gettext string', param => $param, ...) |
78 | 86 | if $condition; |
79 | 87 | |
84 | 92 | report {to => 'syslog', errno => ENOMEM} |
85 | 93 | , FAULT => __x"cannot allocate {size} bytes", size => $size; |
86 | 94 | |
87 | # avoid messages without report level for daemons | |
95 | # Avoid messages without report level for daemons | |
88 | 96 | print __"Hello World", "\n"; # only translation, no exception |
89 | print __'Hello World'; # ERROR!! ' is alternative for :: | |
90 | 97 | |
91 | 98 | # fill-in values, like Locale::TextDomain and gettext |
92 | 99 | # See Log::Report::Message section DETAILS |
101 | 108 | if($@) {...} # $@ isa Log::Report::Dispatcher::Try |
102 | 109 | |
103 | 110 | # Language translations at the IO/layer |
104 | use POSIX ':locale_h'; | |
111 | use POSIX::1003::Locale qw/setlocale LC_ALL/; | |
105 | 112 | setlocale(LC_ALL, 'nl_NL'); |
106 | info __"Hello World!"; # in Dutch, if translation table found | |
113 | info __"Hello World!"; # in Dutch, if translation table found | |
107 | 114 | |
108 | 115 | # Exception classes, see Log::Report::Exception |
109 | my $msg = __x"something", _class => 'local,mine'; | |
110 | if($msg->inClass('local')) ... | |
116 | my $msg = __x"something", _class => 'parsing,schema'; | |
117 | if($msg->inClass('parsing')) ... | |
111 | 118 | |
112 | 119 | =chapter DESCRIPTION |
113 | 120 | Handling messages to users can be a hassle, certainly when the same |
265 | 272 | } |
266 | 273 | else |
267 | 274 | { # untranslated message into object |
268 | @_%2 and error __x"odd length parameter list with '$message'"; | |
275 | @_%2 and error __x"odd length parameter list with '{msg}'", msg => $message; | |
269 | 276 | $message = Log::Report::Message->new(_prepend => $message, @_); |
270 | 277 | } |
271 | 278 | |
789 | 796 | =option translator Log::Report::Translator |
790 | 797 | =default translator <rescue> |
791 | 798 | Without explicit translator, a dummy translator is used for the domain |
792 | which will use the untranslated message-id . | |
799 | which will use the untranslated message-id. | |
793 | 800 | |
794 | 801 | =option native_language CODESET |
795 | 802 | =default native_language 'en_US' |
810 | 817 | use Log::Report 'my-domain'; # in each package producing messages |
811 | 818 | |
812 | 819 | use Log::Report 'my-domain' # in one package, top of distr |
813 | , translator => Log::Report::Translator::POT->new | |
814 | ( lexicon => '/home/me/locale' # bindtextdomain | |
815 | , charset => 'UTF-8' # codeset | |
820 | , mode => 'VERBOSE' | |
821 | , translator => Log::Report::Translator::POT->new | |
822 | ( lexicon => '/home/me/locale' # bindtextdomain | |
823 | , charset => 'UTF-8' # codeset | |
816 | 824 | ) |
817 | 825 | , native_language => 'nl_NL' # untranslated msgs are Dutch |
818 | 826 | , syntax => 'REPORT';# report ERROR, not error() |
851 | 859 | |
852 | 860 | my @export = (@functions, @make_msg); |
853 | 861 | |
854 | if($syntax eq 'SHORT') { push @export, @reason_functions } | |
862 | if($syntax eq 'SHORT') | |
863 | { push @export, @reason_functions | |
864 | } | |
855 | 865 | elsif($syntax ne 'REPORT' && $syntax ne 'LONG') |
856 | 866 | { error __x"syntax flag must be either SHORT or REPORT, not `{syntax}'" |
857 | 867 | , syntax => $syntax; |
0 | #!/usr/bin/perl | |
0 | #!/usr/bin/env perl | |
1 | 1 | use warnings; |
2 | 2 | use strict; |
3 | use lib 'lib', '../lib'; | |
4 | 3 | |
5 | use Test::More tests => 16; | |
4 | use Test::More tests => 18; | |
6 | 5 | |
7 | 6 | # The versions of the following packages are reported to help understanding |
8 | 7 | # the environment in which the tests are run. This is certainly not a |
36 | 35 | use_ok('Log::Report::Dispatcher::Perl'); |
37 | 36 | use_ok('Log::Report::Dispatcher::Callback'); |
38 | 37 | use_ok('Log::Report::Exception'); |
38 | use_ok('Log::Report::Extract'); | |
39 | use_ok('Log::Report::Extract::Template'); | |
39 | 40 | use_ok('Log::Report::Lexicon::Index'); |
40 | 41 | use_ok('Log::Report::Lexicon::PO'); |
41 | 42 | use_ok('Log::Report::Lexicon::POT'); |
0 | #!/usr/bin/perl | |
0 | #!/usr/bin/env perl | |
1 | 1 | use warnings; |
2 | 2 | use strict; |
3 | use lib 'lib', '../lib'; | |
4 | 3 | |
5 | 4 | use Test::More tests => 53; |
6 | 5 |
0 | #!/usr/bin/perl | |
0 | #!/usr/bin/env perl | |
1 | 1 | # Try Lexicon PO modifications |
2 | 2 | |
3 | 3 | use warnings; |
4 | 4 | use strict; |
5 | use lib 'lib', '../lib'; | |
6 | 5 | use utf8; |
7 | 6 | |
8 | 7 | use Test::More tests => 29; |
0 | #!/usr/bin/perl | |
0 | #!/usr/bin/env perl | |
1 | 1 | # Try Lexicon POTcompact |
2 | 2 | # Structure of parsed result has also been checked manually, using |
3 | 3 | # Data::Dumper (MO 2007/05/11) |
0 | #!/usr/bin/perl | |
0 | #!/usr/bin/env perl | |
1 | 1 | # test the lexicon index. |
2 | 2 | |
3 | 3 | use warnings; |
4 | 4 | use strict; |
5 | use lib 'lib', '../lib'; | |
6 | 5 | |
7 | 6 | use Test::More; |
8 | 7 |
0 | #!/usr/bin/perl | |
0 | #!/usr/bin/env perl | |
1 | 1 | # Try Extract PPI |
2 | 2 | |
3 | 3 | use warnings; |
4 | 4 | use strict; |
5 | use lib 'lib', '../lib'; | |
6 | 5 | |
7 | 6 | use File::Temp qw/tempdir/; |
8 | 7 | use Test::More; |
0 | #!/usr/bin/perl | |
0 | #!/usr/bin/env perl | |
1 | 1 | # Convert die into report |
2 | 2 | |
3 | 3 | use warnings; |
4 | 4 | use strict; |
5 | use lib 'lib', '../lib', 't'; | |
5 | use lib 't'; | |
6 | 6 | |
7 | 7 | use POSIX; |
8 | 8 |
0 | #!/usr/bin/env perl | |
1 | # Try Extract templates | |
2 | ||
3 | use warnings; | |
4 | use strict; | |
5 | ||
6 | use File::Temp qw/tempdir/; | |
7 | ||
8 | use Test::More; | |
9 | ||
10 | use Log::Report; # mode => 'DEBUG'; | |
11 | use Log::Report::Lexicon::POT; | |
12 | use Log::Report::Extract::Template; | |
13 | ||
14 | use constant MSGIDS => 5; | |
15 | ||
16 | # see after __END__ | |
17 | my @expect_pos = split /\n/, <<'_EXPECT'; | |
18 | first | |
19 | second | |
20 | third | |
21 | fourth | |
22 | fifth | |
23 | _EXPECT | |
24 | ||
25 | chomp $expect_pos[-1]; | |
26 | cmp_ok(scalar @expect_pos, '==', MSGIDS); | |
27 | my %expect_pos = map { ($_ => 1) } @expect_pos; | |
28 | $expect_pos{''} = 1; # header | |
29 | ||
30 | BEGIN { | |
31 | plan tests => 15 + MSGIDS*3; | |
32 | } | |
33 | ||
34 | my $lexicon = tempdir CLEANUP => 1; | |
35 | ||
36 | my $extr = Log::Report::Extract::Template->new | |
37 | ( lexicon => $lexicon | |
38 | , domain => 'my-domain' | |
39 | , pattern => 'TT2-loc' | |
40 | ); | |
41 | ||
42 | ok(defined $extr, 'created parser'); | |
43 | isa_ok($extr, 'Log::Report::Extract::Template'); | |
44 | ||
45 | my $found = $extr->process( __FILE__ ); # yes, this file! | |
46 | cmp_ok($found, '==', MSGIDS); | |
47 | ||
48 | $extr->write; | |
49 | ||
50 | my @potfns = $extr->index->list('my-domain'); | |
51 | cmp_ok(scalar @potfns, '==', 1, "one file created"); | |
52 | my $potfn = shift @potfns; | |
53 | ok(defined $potfn); | |
54 | ok(-s $potfn, "produced file $potfn has size"); | |
55 | ||
56 | #system "cat $potfn"; | |
57 | ||
58 | # | |
59 | ||
60 | my $pot = Log::Report::Lexicon::POT->read($potfn, charset => 'utf-8'); | |
61 | ok(defined $pot, 'read translation table'); | |
62 | my @pos = $pot->translations('ACTIVE'); | |
63 | ok(@pos > 0); | |
64 | ||
65 | # (+1 for the header) | |
66 | cmp_ok(scalar @pos, '==', MSGIDS+1, 'correct number tests'); | |
67 | cmp_ok(scalar @pos, '==', scalar $pot->translations); # all active | |
68 | ||
69 | my %msgids; | |
70 | for my $po (@pos) | |
71 | { my $msgid = $po->msgid; | |
72 | ok(defined $msgid, "processing '$msgid'"); | |
73 | ok(!defined $msgids{$msgid}, 'check not double'); | |
74 | $msgids{$msgid}++; | |
75 | ok(delete $expect_pos{$msgid}, 'was expected'); | |
76 | } | |
77 | ||
78 | cmp_ok(scalar keys %expect_pos, '==', 0, "all msgids found"); | |
79 | warn "NOT FOUND: $_\n" for keys %expect_pos; | |
80 | ||
81 | __END__ | |
82 | Here, the example template starts | |
83 | [%loc("first")%] | |
84 | [%loc("second")%] | |
85 | [%loc('third')%] | |
86 | [% loc ( 'fourth' ) %] | |
87 | [% | |
88 | loc | |
89 | ( | |
90 | 'fifth' | |
91 | , params | |
92 | ) | |
93 | %] | |
94 | [%xloc('not found')%] |
0 | #!/usr/bin/perl | |
0 | #!/usr/bin/env perl | |
1 | 1 | # test the file back-end, without translations |
2 | 2 | |
3 | 3 | use warnings; |
4 | 4 | use strict; |
5 | use lib 'lib', '../lib'; | |
6 | 5 | |
7 | 6 | use Test::More tests => 38; |
8 | 7 |
0 | #!/usr/bin/perl | |
0 | #!/usr/bin/env perl | |
1 | 1 | # Test syslog, but only mildly |
2 | 2 | |
3 | 3 | use warnings; |
4 | 4 | use strict; |
5 | use lib 'lib', '../lib'; | |
6 | 5 | |
7 | 6 | use Test::More; |
8 | ||
9 | 7 | use Log::Report undef, syntax => 'SHORT'; |
10 | 8 | |
11 | 9 | BEGIN |
0 | #!/usr/bin/perl | |
0 | #!/usr/bin/env perl | |
1 | 1 | # Test Log::Dispatch (only very simple tests) |
2 | 2 | |
3 | 3 | use warnings; |
0 | #!/usr/bin/perl | |
0 | #!/usr/bin/env perl | |
1 | 1 | # Test Log::Log4perl (only very simple tests) |
2 | 2 | |
3 | 3 | use warnings; |
4 | 4 | use strict; |
5 | use lib 'lib', '../lib'; | |
6 | 5 | |
7 | 6 | use File::Temp qw/tempfile/; |
8 | 7 | use Test::More; |
0 | #!/usr/bin/perl | |
0 | #!/usr/bin/env perl | |
1 | 1 | # Test try() |
2 | 2 | |
3 | 3 | use warnings; |
4 | 4 | use strict; |
5 | use lib 'lib', '../lib'; | |
6 | 5 | |
7 | 6 | use Test::More tests => 49; |
8 | 7 | |
129 | 128 | my $die_ex = $@->wasFatal; |
130 | 129 | isa_ok($die_ex, 'Log::Report::Exception'); |
131 | 130 | is($die_ex->reason, 'ERROR'); |
132 | like("$@", qr[^try-block stopped with ERROR: oops at t/54try\.t line \d+$] ); | |
131 | like("$@", qr[^try-block stopped with ERROR: oops at ] ); | |
133 | 132 | |
134 | 133 | my $croak = try { croak "oops" }; |
135 | 134 | ok(ref $@, 'caught croak'); |
137 | 136 | my $croak_ex = $@->wasFatal; |
138 | 137 | isa_ok($croak_ex, 'Log::Report::Exception'); |
139 | 138 | is($croak_ex->reason, 'ERROR'); |
140 | like("$@", qr[^try-block stopped with ERROR: oops at lib/Log/Report.pm line \d+$] ); | |
139 | like("$@", qr[^try-block stopped with ERROR: oops at ] ); | |
141 | 140 | |
142 | 141 | my $confess = try { confess "oops" }; |
143 | 142 | ok(ref $@, 'caught confess'); |
145 | 144 | my $confess_ex = $@->wasFatal; |
146 | 145 | isa_ok($confess_ex, 'Log::Report::Exception'); |
147 | 146 | is($confess_ex->reason, 'PANIC'); |
148 | like("$@", qr[^try-block stopped with PANIC: oops at t/54try\.t line \d+$] ); | |
147 | like("$@", qr[^try-block stopped with PANIC: oops at ] ); |
0 | #!/usr/bin/perl | |
1 | use warnings; | |
2 | use strict; | |
3 | ||
4 | use Test::More; | |
5 | ||
6 | BEGIN | |
7 | { eval "use Test::Pod 1.00"; | |
8 | plan skip_all => "Test::Pod 1.00 required for testing POD" if $@; | |
9 | ||
10 | plan skip_all => "devel home uses OODoc" | |
11 | if $ENV{MARKOV_DEVEL}; | |
12 | } | |
13 | ||
14 | all_pod_files_ok(); |
2 | 2 | use strict; |
3 | 3 | |
4 | 4 | use Log::Report::Die qw/die_decode/; |
5 | use Log::Report qw/try/; | |
5 | use Log::Report qw/log-report/; | |
6 | 6 | use Carp; |
7 | 7 | |
8 | 8 | use Test::More tests => 27; |