File Coverage

blib/lib/Locale/PO.pm
Criterion Covered Total %
statement 249 298 83.5
branch 178 244 72.9
condition 8 23 34.7
subroutine 32 39 82.0
pod 27 27 100.0
total 494 631 78.2


line stmt bran cond sub pod time code
1             package Locale::PO;
2 6     6   162200 use strict;
  6         17  
  6         308  
3 6     6   41 use warnings;
  6         11  
  6         365  
4             our $VERSION = '0.26';
5              
6 6     6   51 use Carp;
  6         11  
  6         31498  
7              
8             sub new {
9 1044     1044 1 5081 my $this = shift;
10 1044         3917 my %options = @_;
11 1044   33     3825 my $class = ref($this) || $this;
12 1044         1877 my $self = {};
13 1044         2978 bless $self, $class;
14 1044         2519 $self->_flags([]);
15 1044 100       2659 $self->fuzzy_msgid($options{'-fuzzy_msgid'}) if defined($options{'-fuzzy_msgid'});
16 1044 100       1892 $self->fuzzy_msgid_plural($options{'-fuzzy_msgid_plural'})
17             if defined($options{'-fuzzy_msgid_plural'});
18 1044 100       1856 $self->msgid($options{'-msgid'}) if defined($options{'-msgid'});
19 1044 100       1797 $self->msgid_plural($options{'-msgid_plural'})
20             if defined($options{'-msgid_plural'});
21 1044 100       1732 $self->msgstr($options{'-msgstr'}) if defined($options{'-msgstr'});
22 1044 100       1941 $self->msgstr_n($options{'-msgstr_n'})
23             if defined($options{'-msgstr_n'});
24 1044 50       1900 $self->msgctxt($options{'-msgctxt'}) if defined($options{'-msgctxt'});
25 1044 50       1979 $self->fuzzy_msgctxt($options{'-fuzzy_msgctxt'})
26             if defined($options{'-fuzzy_msgctxt'});
27 1044 100       1750 $self->comment($options{'-comment'}) if defined($options{'-comment'});
28 1044 100       1857 $self->fuzzy($options{'-fuzzy'}) if defined($options{'-fuzzy'});
29 1044 50       1883 $self->automatic($options{'-automatic'})
30             if defined($options{'-automatic'});
31 1044 50       2128 $self->reference($options{'-reference'})
32             if defined($options{'-reference'});
33 1044 50       1730 $self->c_format(1) if defined($options{'-c-format'});
34 1044 50       2350 $self->c_format(1) if defined($options{'-c_format'});
35 1044 50       2282 $self->c_format(0) if defined($options{'-no-c-format'});
36 1044 50       1970 $self->c_format(0) if defined($options{'-no_c_format'});
37 1044 100       3410 $self->loaded_line_number($options{'-loaded_line_number'})
38             if defined($options{'-loaded_line_number'});
39 1044         2413 return $self;
40             }
41              
42             sub fuzzy_msgctxt {
43 1051     1051 1 1109 my $self = shift;
44 1051 100       3345 @_ ? $self->{'fuzzy_msgctxt'} = $self->quote(shift) : $self->{'fuzzy_msgctxt'};
45             }
46              
47             sub fuzzy_msgid {
48 1067     1067 1 1175 my $self = shift;
49 1067 100       3008 @_ ? $self->{'fuzzy_msgid'} = $self->quote(shift) : $self->{'fuzzy_msgid'};
50             }
51              
52             sub fuzzy_msgid_plural {
53 1054     1054 1 1056 my $self = shift;
54             @_
55 1054 100       3087 ? $self->{'fuzzy_msgid_plural'} = $self->quote(shift)
56             : $self->{'fuzzy_msgid_plural'};
57             }
58              
59             sub msgctxt {
60 1057     1057 1 1216 my $self = shift;
61 1057 100       3083 @_ ? $self->{'msgctxt'} = $self->quote(shift) : $self->{'msgctxt'};
62             }
63              
64             sub msgid {
65 2095     2095 1 3259 my $self = shift;
66 2095 100       6662 @_ ? $self->{'msgid'} = $self->quote(shift) : $self->{'msgid'};
67             }
68              
69             sub msgid_plural {
70 1065     1065 1 1426 my $self = shift;
71             @_
72 1065 100       3445 ? $self->{'msgid_plural'} = $self->quote(shift)
73             : $self->{'msgid_plural'};
74             }
75              
76             sub msgstr {
77 3125     3125 1 14996 my $self = shift;
78 3125 100       11557 @_ ? $self->{'msgstr'} = $self->quote(shift) : $self->{'msgstr'};
79             }
80              
81             sub msgstr_n {
82 1057     1057 1 1271 my $self = shift;
83 1057 100       2009 if (@_) {
84 8         12 my $hashref = shift;
85              
86             # check that we have a hashref.
87 8 50       32 croak 'Argument to msgstr_n must be a hashref: { n => "string n", ... }.'
88             unless ref($hashref) eq 'HASH';
89              
90             # Check that the keys are all numbers.
91 15         64 croak 'Keys to msgstr_n hashref must be numbers'
92 8 50       32 if grep {m/\D/} keys %$hashref;
93              
94             # Quote all the values in the hashref.
95 8         37 $self->{'msgstr_n'}{$_} = $self->quote($$hashref{$_}) for keys %$hashref;
96              
97             }
98              
99 1057         2703 return $self->{'msgstr_n'};
100             }
101              
102             sub comment {
103 1112     1112 1 1205 my $self = shift;
104 1112 100       11636 @_ ? $self->{'comment'} = shift : $self->{'comment'};
105             }
106              
107             sub automatic {
108 1049     1049 1 1217 my $self = shift;
109 1049 50       7953 @_ ? $self->{'automatic'} = shift : $self->{'automatic'};
110             }
111              
112             sub reference {
113 4126     4126 1 12606 my $self = shift;
114 4126 100       26022 @_ ? $self->{'reference'} = shift : $self->{'reference'};
115             }
116              
117             sub obsolete {
118 2108     2108 1 11952 my $self = shift;
119 2108 100       6047 @_ ? $self->{'obsolete'} = shift : $self->{'obsolete'};
120             }
121              
122             sub fuzzy {
123 1     1 1 2 my $self = shift;
124              
125 1 50       4 if (@_) {
126 1         2 my $value = shift;
127 1 50       5 $value ? $self->add_flag('fuzzy') : $self->remove_flag('fuzzy');
128             }
129              
130 1         4 return $self->has_flag('fuzzy');
131             }
132              
133             sub c_format {
134 0     0 1 0 my $self = shift;
135              
136 0         0 return $self->_tri_value_flag('c-format', @_);
137             }
138              
139             sub php_format {
140 0     0 1 0 my $self = shift;
141              
142 0         0 return $self->_tri_value_flag('php-format', @_);
143             }
144              
145             sub _flags {
146 2144     2144   2307 my $self = shift;
147 2144 100       8111 @_ ? $self->{'_flags'} = shift : $self->{'_flags'};
148             }
149              
150             sub _tri_value_flag {
151 0     0   0 my $self = shift;
152 0         0 my $flag_name = shift;
153 0 0       0 if (@_) { # set or clear the flags
154 0         0 my $value = shift;
155 0 0 0     0 if (!defined($value) || $value eq "") {
    0          
156 0         0 $self->remove_flag("$flag_name");
157 0         0 $self->remove_flag("no-$flag_name");
158 0         0 return undef;
159             }
160             elsif ($value) {
161 0         0 $self->add_flag("$flag_name");
162 0         0 $self->remove_flag("no-$flag_name");
163 0         0 return 1;
164             }
165             else {
166 0         0 $self->add_flag("no-$flag_name");
167 0         0 $self->remove_flag("$flag_name");
168 0         0 return 0;
169             }
170             }
171             else { # check the flags
172 0 0       0 return 1 if $self->has_flag("$flag_name");
173 0 0       0 return 0 if $self->has_flag("no-$flag_name");
174 0         0 return undef;
175             }
176             }
177              
178             sub add_flag {
179 25     25 1 41 my ($self, $flag_name) = @_;
180 25 50       61 if (! $self->has_flag($flag_name)) {
181 25         28 push @{$self->_flags}, $flag_name;
  25         48  
182             }
183 25         149 return;
184             }
185              
186             sub remove_flag {
187 0     0 1 0 my ($self, $flag_name) = @_;
188 0         0 my @new_flags;
189 0         0 foreach my $flag (@{$self->_flags}) {
  0         0  
190 0 0       0 push @new_flags, $flag unless $flag eq $flag_name;
191             }
192 0         0 $self->_flags(\@new_flags);
193 0         0 return;
194             }
195              
196             sub has_flag {
197 26     26 1 33 my ($self, $flag_name) = @_;
198 26         32 foreach my $flag (@{$self->_flags}) {
  26         47  
199 7 100       23 return 1 if $flag eq $flag_name;
200             }
201 25         75 return;
202             }
203              
204             sub loaded_line_number {
205 1041     1041 1 5057 my $self = shift;
206 1041 100       2900 @_ ? $self->{'loaded_line_number'} = shift : $self->{'loaded_line_number'};
207             }
208              
209             sub _normalize_str {
210 2131     2131   2451 my $self = shift;
211 2131         4295 my $string = shift;
212 2131         3875 my $dequoted = $self->dequote($string);
213              
214             # Multiline: this isn't quite perfect, but fast and easy
215 2131 100 66     10219 if (defined $dequoted && $dequoted =~ /\n/) {
216 188         206 my $output;
217             my @lines;
218 188         852 @lines = split(/\n/, $dequoted, -1);
219 188         313 my $lastline = pop @lines; # special treatment for this one
220 188 100       612 $output = qq{""\n} if ($#lines != 0);
221 188         322 foreach (@lines) {
222 309         842 $output .= $self->quote("$_\n") . "\n";
223             }
224 188 100       448 $output .= $self->quote($lastline) . "\n" if $lastline ne "";
225 188         647 return $output;
226             }
227             # Single line
228             else {
229 1943   50     19340 return ($string || "") . "\n";
230             }
231             }
232              
233             sub _fuzzy_normalize_str {
234 13     13   15 my $self = shift;
235 13         15 my $string = shift;
236 13         13 my $prefix = shift;
237              
238 13         26 my $normalized = $self->_normalize_str($string);
239              
240             # on newlines, start them with "#| " or "#~| "
241 13         36 $normalized =~ s/\n"/\n$prefix"/g;
242              
243 13         33 return $normalized;
244             }
245              
246             sub dump {
247 1049     1049 1 5598 my $self = shift;
248 1049 100       1980 my $obsolete = $self->obsolete ? '#~ ' : '';
249 1049 100       1824 my $fuzzy_prefix = $self->obsolete ? '#~| ' : '#| ';
250 1049         990 my $dump;
251              
252 1049 100       1795 $dump = $self->_dump_multi_comment($self->comment, "# ")
253             if ($self->comment);
254 1049 50       2013 $dump .= $self->_dump_multi_comment($self->automatic, "#. ")
255             if ($self->automatic);
256 1049 100       1928 $dump .= $self->_dump_multi_comment($self->reference, "#: ")
257             if ($self->reference);
258              
259 1049         1696 my $flags = '';
260              
261 1049         1076 foreach my $flag (@{$self->_flags}) {
  1049         1939  
262 29         142 $flags .= ", $flag";
263             }
264              
265 1049 100       2653 $dump .= "#$flags\n"
266             if length $flags;
267              
268 1049 100       1965 $dump
269             .= "${fuzzy_prefix}msgctxt "
270             . $self->_fuzzy_normalize_str($self->fuzzy_msgctxt, $fuzzy_prefix)
271             if $self->fuzzy_msgctxt;
272 1049 100       1991 $dump
273             .= "${fuzzy_prefix}msgid "
274             . $self->_fuzzy_normalize_str($self->fuzzy_msgid, $fuzzy_prefix)
275             if $self->fuzzy_msgid;
276 1049 100       1967 $dump
277             .= "${fuzzy_prefix}msgid_plural "
278             . $self->_fuzzy_normalize_str($self->fuzzy_msgid_plural, $fuzzy_prefix)
279             if $self->fuzzy_msgid_plural;
280              
281 1049 100       2192 $dump .= "${obsolete}msgctxt " . $self->_normalize_str($self->msgctxt)
282             if $self->msgctxt;
283 1049         2478 $dump .= "${obsolete}msgid " . $self->_normalize_str($self->msgid);
284 1049 100       2629 $dump .= "${obsolete}msgid_plural " . $self->_normalize_str($self->msgid_plural)
285             if $self->msgid_plural;
286              
287 1049 100       2068 $dump .= "${obsolete}msgstr " . $self->_normalize_str($self->msgstr) if $self->msgstr;
288              
289 1049 100       2544 if (my $msgstr_n = $self->msgstr_n) {
290 9         65 $dump .= "${obsolete}msgstr[$_] " . $self->_normalize_str($$msgstr_n{$_})
291 9         55 for sort { $a <=> $b } keys %$msgstr_n;
292             }
293              
294 1049         1197 $dump .= "\n";
295 1049         77574 return $dump;
296             }
297              
298             sub _dump_multi_comment {
299 1032     1032   1144 my $self = shift;
300 1032         1163 my $comment = shift;
301 1032         1059 my $leader = shift;
302 1032         1112 my $chopped = $leader;
303 1032         1287 chop($chopped);
304 1032         1489 my $result = $leader . $comment;
305 1032         1749 $result =~ s/\n/\n$leader/g;
306 1032         3555 $result =~ s/^$leader$/$chopped/gm;
307 1032         1180 $result .= "\n";
308 1032         2611 return $result;
309             }
310              
311             # Quote a string properly
312             sub quote {
313 2429     2429 1 2713 my $self = shift;
314 2429         3019 my $string = shift;
315              
316             return undef
317 2429 50       5587 unless defined $string;
318              
319 2429         3100 $string =~ s/\\(?!t)/\\\\/g; # \t is a tab
320 2429         2935 $string =~ s/"/\\"/g;
321 2429         4204 $string =~ s/\n/\\n/g;
322 2429         8542 return "\"$string\"";
323             }
324              
325             sub dequote {
326 4343     4343 1 14142 my $self = shift;
327 4343         7599 my $string = shift;
328              
329             return undef
330 4343 50       8551 unless defined $string;
331              
332 4343         20418 $string =~ s/^"(.*)"/$1/;
333 4343         6848 $string =~ s/\\"/"/g;
334 4343         5748 $string =~ s/(?
335 4343         16374 $string =~ s/(?
336 4343         4466 $string =~ s/(?
337 4343         4416 $string =~ s/\\{4}n/\\\\n/g; # \ followed by inline newline
338 4343         4442 $string =~ s/\\\\(?!n)/\\/g; # all slashes not related to a newline
339 4343         10581 return $string;
340             }
341              
342             sub save_file_fromarray {
343 8     8 1 2461 my $self = shift;
344 8         43 $self->_save_file(0, @_);
345             }
346              
347             sub save_file_fromhash {
348 0     0 1 0 my $self = shift;
349 0         0 $self->_save_file(1, @_);
350             }
351              
352             sub _save_file {
353 8     8   15 my $self = shift;
354 8         29 my $ashash = shift;
355 8         15 my $file = shift;
356 8         16 my $entries = shift;
357 8         47 my $encoding = shift;
358              
359 8 100       1253 open(OUT, defined($encoding) ? ">:encoding($encoding)" : ">", $file)
    50          
360             or return undef;
361 8 50       77 if ($ashash) {
362 0         0 foreach (sort keys %$entries) {
363 0         0 print OUT $entries->{$_}->dump;
364             }
365             }
366             else {
367 8         31 foreach (@$entries) {
368 1037         14566 print OUT $_->dump;
369             }
370             }
371              
372 8         794 close OUT;
373             }
374              
375             sub load_file_asarray {
376 9     9 1 1961 my $self = shift;
377 9         51 $self->_load_file(0, @_);
378             }
379              
380             sub load_file_ashash {
381 0     0 1 0 my $self = shift;
382 0         0 $self->_load_file(1, @_);
383             }
384              
385             sub _load_file {
386 9     9   19 my $self = shift;
387 9         17 my $ashash = shift;
388 9         18 my $file = shift;
389 9         18 my $encoding = shift;
390 9   33     70 my $class = ref $self || $self;
391 9         15 my (@entries, %entries);
392 9         20 my $line_number = 0;
393 9         14 my $po;
394             my %buffer;
395 0         0 my $last_buffer;
396              
397 9 100   1   530 open(IN, defined($encoding) ? "<:encoding($encoding)" : "<", $file)
  1 50       10  
  1         1  
  1         10  
398             or return undef;
399              
400 9         14738 while () {
401 4314         5401 chomp;
402 4314         3678 $line_number++;
403              
404             #
405             # Strip trailing \r\n chars
406             #
407             # This can possibly have an effect only on msys (on which chomp
408             # seems to leave some trailing \r chars) and on MacOS that has
409             # reversed newline (\n\r).
410             # Note that our stripping of those trailing chars is only going to be
411             # useful when writing from one platform and reading on another.
412 4314         39311 s{[\r\n]*$}{};
413              
414 4314 100 100     49303 if (/^$/) {
    100          
    50          
    100          
    100          
    100          
    100          
    100          
    100          
    100          
    100          
    100          
    100          
    50          
415              
416             # Empty line. End of an entry.
417              
418 1037 50       2097 if (defined($po)) {
419 1037 100       2098 $po->fuzzy_msgctxt($buffer{fuzzy_msgctxt})
420             if defined $buffer{fuzzy_msgctxt};
421 1037 100       2058 $po->fuzzy_msgid($buffer{fuzzy_msgid}) if defined $buffer{fuzzy_msgid};
422 1037 100       1861 $po->fuzzy_msgid_plural($buffer{fuzzy_msgid_plural})
423             if defined $buffer{fuzzy_msgid_plural};
424 1037 100       7319 $po->msgctxt($buffer{msgctxt}) if defined $buffer{msgctxt};
425 1037 50       4032 $po->msgid($buffer{msgid}) if defined $buffer{msgid};
426 1037 100       3240 $po->msgid_plural($buffer{msgid_plural}) if defined $buffer{msgid_plural};
427 1037 100       4359 $po->msgstr($buffer{msgstr}) if defined $buffer{msgstr};
428 1037 100       2282 $po->msgstr_n($buffer{msgstr_n}) if defined $buffer{msgstr_n};
429              
430              
431             # ashash
432 1037 50       1604 if ($ashash) {
433 0 0       0 $entries{$po->msgid} = $po
434             if ($po->_hash_key_ok(\%entries));
435             }
436              
437             # asarray
438             else {
439 1037         1864 push(@entries, $po);
440             }
441              
442 1037         1341 undef $po;
443 1037         1001 undef $last_buffer;
444 1037         5851 %buffer = ();
445             }
446             }
447             elsif (/^#\s+(.*)/ or /^#()$/) {
448              
449             # Translator comments
450 19 100       72 $po = $class->new(-loaded_line_number => $line_number) unless defined($po);
451 19 100       49 if (defined($po->comment)) {
452 15         30 $po->comment($po->comment . "\n$1");
453             }
454             else {
455 4         18 $po->comment($1);
456             }
457             }
458             elsif (/^#\.\s*(.*)/) {
459              
460             # Automatic comments
461 0 0       0 $po = $class->new(-loaded_line_number => $line_number) unless defined($po);
462 0 0       0 if (defined($po->automatic)) {
463 0         0 $po->automatic($po->automatic . "\n$1");
464             }
465             else {
466 0         0 $po->automatic($1);
467             }
468             }
469             elsif (/^#:\s+(.*)/) {
470              
471             # reference
472 1026 100       4849 $po = $class->new(-loaded_line_number => $line_number) unless defined($po);
473 1026 100       2627 if (defined($po->reference)) {
474 2         8 $po->reference($po->reference . "\n$1");
475             }
476             else {
477 1024         2028 $po->reference($1);
478             }
479             }
480             elsif (/^#,\s+(.*)/) {
481              
482             # flags
483 20         108 my @flags = split /\s*[,]\s*/, $1;
484 20 100       79 $po = $class->new(-loaded_line_number => $line_number) unless defined($po);
485 20         36 foreach my $flag (@flags) {
486 24         86 $po->add_flag($flag);
487             }
488             }
489             elsif (/^#(~)?\|\s+msgctxt\s+(.*)/) {
490 1 50       5 $po = $class->new(-loaded_line_number => $line_number) unless defined($po);
491 1         3 $buffer{fuzzy_msgctxt} = $self->dequote($2);
492 1         2 $last_buffer = \$buffer{fuzzy_msgctxt};
493 1 50       7 $po->obsolete(1) if $1;
494             }
495             elsif (/^#(~)?\|\s+msgid\s+(.*)/) {
496 7 50       16 $po = $class->new(-loaded_line_number => $line_number) unless defined($po);
497 7         16 $buffer{fuzzy_msgid} = $self->dequote($2);
498 7         10 $last_buffer = \$buffer{fuzzy_msgid};
499 7 100       69 $po->obsolete(1) if $1;
500             }
501             elsif (/^#(~)?\|\s+msgid_plural\s+(.*)/) {
502 1 50       4 $po = $class->new(-loaded_line_number => $line_number) unless defined($po);
503 1         4 $buffer{fuzzy_msgid_plural} = $self->dequote($2);
504 1         3 $last_buffer = \$buffer{fuzzy_msgid_plural};
505 1 50       8 $po->obsolete(1) if $1;
506             }
507             elsif (/^(#~\s+)?msgctxt\s+(.*)/) {
508 4 50       19 $po = $class->new(-loaded_line_number => $line_number) unless defined($po);
509 4         16 $buffer{msgctxt} = $self->dequote($2);
510 4         14 $last_buffer = \$buffer{msgctxt};
511 4 50       30 $po->obsolete(1) if $1;
512             }
513             elsif (/^(#~\s+)?msgid\s+(.*)/) {
514 1039 100       2219 $po = $class->new(-loaded_line_number => $line_number) unless defined($po);
515 1039         2951 $buffer{msgid} = $self->dequote($2);
516 1039         2353 $last_buffer = \$buffer{msgid};
517 1039 100       5829 $po->obsolete(1) if $1;
518             }
519             elsif (/^(#~\s+)?msgid_plural\s+(.*)/) {
520 5 50       18 $po = $class->new(-loaded_line_number => $line_number) unless defined($po);
521 5         14 $buffer{msgid_plural} = $self->dequote($2);
522 5         12 $last_buffer = \$buffer{msgid_plural};
523 5 100       38 $po->obsolete(1) if $1;
524             }
525             elsif (/^(?:#~\s+)?msgstr\s+(.*)/) {
526              
527             # translated string
528 1033         2695 $buffer{msgstr} = $self->dequote($1);
529 1033         4742 $last_buffer = \$buffer{msgstr};
530             }
531             elsif (/^(?:#~\s+)?msgstr\[(\d+)\]\s+(.*)/) {
532              
533             # translated string
534 10         27 $buffer{msgstr_n}{$1} = $self->dequote($2);
535 10         48 $last_buffer = \$buffer{msgstr_n}{$1};
536             }
537             elsif (/^(?:#(?:~|~\||\|)\s+)?(".*)/) {
538              
539             # continued string. Accounts for:
540             # normal : "string"
541             # obsolete : #~ "string"
542             # fuzzy : #| "string"
543             # fuzzy+obsolete : #~| "string"
544 112         309 $$last_buffer .= $self->dequote($1);
545             }
546             else {
547 0         0 warn "Strange line at $file line $line_number: [$_]\n";
548             }
549             }
550 9 100       39 if (defined($po)) {
551              
552 2 50       7 $po->msgctxt($buffer{msgctxt})
553             if defined $buffer{msgctxt};
554 2 50       10 $po->msgid($buffer{msgid})
555             if defined $buffer{msgid};
556 2 50       7 $po->msgid_plural($buffer{msgid_plural})
557             if defined $buffer{msgid_plural};
558 2 50       9 $po->msgstr($buffer{msgstr})
559             if defined $buffer{msgstr};
560 2 50       6 $po->msgstr_n($buffer{msgstr_n})
561             if defined $buffer{msgstr_n};
562              
563             # ashash
564 2 50       11 if ($ashash) {
565 0 0       0 if ($po->_hash_key_ok(\%entries)) {
566 0         0 $entries{$po->msgid} = $po;
567             }
568             }
569              
570             # asarray
571             else {
572 2         3 push(@entries, $po);
573             }
574             }
575 9         242 close IN;
576 9 50       101 return ($ashash ? \%entries : \@entries);
577             }
578              
579             sub _hash_key_ok {
580 0     0   0 my ($self, $entries) = @_;
581              
582 0         0 my $key = $self->msgid;
583              
584 0 0       0 if ($entries->{$key}) {
585              
586             # don't overwrite non-obsolete entries with obsolete ones
587 0 0 0     0 return if (($self->obsolete) && (not $entries->{$key}->obsolete));
588              
589             # don't overwrite translated entries with untranslated ones
590 0 0 0     0 return if (($self->msgstr !~ /\w/) && ($entries->{$key}->msgstr =~ /\w/));
591             }
592              
593 0         0 return 1;
594             }
595              
596             # Autoload methods go after =cut, and are processed by the autosplit program.
597              
598             1;
599             __END__