File Coverage

blib/lib/Locale/PO.pm
Criterion Covered Total %
statement 252 298 84.5
branch 185 244 75.8
condition 8 23 34.7
subroutine 32 39 82.0
pod 27 27 100.0
total 504 631 79.8


line stmt bran cond sub pod time code
1             package Locale::PO;
2 9     9   143762 use strict;
  9         15  
  9         297  
3 9     9   36 use warnings;
  9         12  
  9         335  
4             our $VERSION = '0.27';
5              
6 9     9   44 use Carp;
  9         11  
  9         28082  
7              
8             sub new {
9 1970     1970 1 4670 my $this = shift;
10 1970         3037 my %options = @_;
11 1970   33     4948 my $class = ref($this) || $this;
12 1970         2033 my $self = {};
13 1970         3079 bless $self, $class;
14 1970         2999 $self->_flags([]);
15 1970 100       3135 $self->fuzzy_msgid($options{'-fuzzy_msgid'}) if defined($options{'-fuzzy_msgid'});
16 1970 100       2699 $self->fuzzy_msgid_plural($options{'-fuzzy_msgid_plural'})
17             if defined($options{'-fuzzy_msgid_plural'});
18 1970 100       2817 $self->msgid($options{'-msgid'}) if defined($options{'-msgid'});
19 1970 100       2681 $self->msgid_plural($options{'-msgid_plural'})
20             if defined($options{'-msgid_plural'});
21 1970 100       2629 $self->msgstr($options{'-msgstr'}) if defined($options{'-msgstr'});
22 1970 100       2663 $self->msgstr_n($options{'-msgstr_n'})
23             if defined($options{'-msgstr_n'});
24 1970 50       2620 $self->msgctxt($options{'-msgctxt'}) if defined($options{'-msgctxt'});
25 1970 50       2718 $self->fuzzy_msgctxt($options{'-fuzzy_msgctxt'})
26             if defined($options{'-fuzzy_msgctxt'});
27 1970 100       2379 $self->comment($options{'-comment'}) if defined($options{'-comment'});
28 1970 100       2404 $self->fuzzy($options{'-fuzzy'}) if defined($options{'-fuzzy'});
29 1970 50       2417 $self->automatic($options{'-automatic'})
30             if defined($options{'-automatic'});
31 1970 50       2437 $self->reference($options{'-reference'})
32             if defined($options{'-reference'});
33 1970 50       2476 $self->c_format(1) if defined($options{'-c-format'});
34 1970 50       2514 $self->c_format(1) if defined($options{'-c_format'});
35 1970 50       2615 $self->c_format(0) if defined($options{'-no-c-format'});
36 1970 50       2428 $self->c_format(0) if defined($options{'-no_c_format'});
37 1970 100       4296 $self->loaded_line_number($options{'-loaded_line_number'})
38             if defined($options{'-loaded_line_number'});
39 1970         2803 return $self;
40             }
41              
42             sub fuzzy_msgctxt {
43 1515     1515 1 1052 my $self = shift;
44 1515 100       3025 @_ ? $self->{'fuzzy_msgctxt'} = $self->quote(shift) : $self->{'fuzzy_msgctxt'};
45             }
46              
47             sub fuzzy_msgid {
48 1834     1834 1 2660 my $self = shift;
49 1834 100       3578 @_ ? $self->{'fuzzy_msgid'} = $self->quote(shift) : $self->{'fuzzy_msgid'};
50             }
51              
52             sub fuzzy_msgid_plural {
53 1518     1518 1 1028 my $self = shift;
54             @_
55 1518 100       2916 ? $self->{'fuzzy_msgid_plural'} = $self->quote(shift)
56             : $self->{'fuzzy_msgid_plural'};
57             }
58              
59             sub msgctxt {
60 1521     1521 1 1049 my $self = shift;
61 1521 100       2871 @_ ? $self->{'msgctxt'} = $self->quote(shift) : $self->{'msgctxt'};
62             }
63              
64             sub msgid {
65 3486     3486 1 3624 my $self = shift;
66 3486 100       6409 @_ ? $self->{'msgid'} = $self->quote(shift) : $self->{'msgid'};
67             }
68              
69             sub msgid_plural {
70 1529     1529 1 1245 my $self = shift;
71             @_
72 1529 100       3250 ? $self->{'msgid_plural'} = $self->quote(shift)
73             : $self->{'msgid_plural'};
74             }
75              
76             sub msgstr {
77 4981     4981 1 9202 my $self = shift;
78 4981 100       9870 @_ ? $self->{'msgstr'} = $self->quote(shift) : $self->{'msgstr'};
79             }
80              
81             sub msgstr_n {
82 1521     1521 1 1144 my $self = shift;
83 1521 100       2079 if (@_) {
84 8         7 my $hashref = shift;
85              
86             # check that we have a hashref.
87 8 50       20 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         37 croak 'Keys to msgstr_n hashref must be numbers'
92 8 50       21 if grep {m/\D/} keys %$hashref;
93              
94             # Quote all the values in the hashref.
95 8         26 $self->{'msgstr_n'}{$_} = $self->quote($$hashref{$_}) for keys %$hashref;
96              
97             }
98              
99 1521         2466 return $self->{'msgstr_n'};
100             }
101              
102             sub comment {
103 1619     1619 1 1336 my $self = shift;
104 1619 100       3431 @_ ? $self->{'comment'} = shift : $self->{'comment'};
105             }
106              
107             sub automatic {
108 3798     3798 1 2737 my $self = shift;
109 3798 100       9927 @_ ? $self->{'automatic'} = shift : $self->{'automatic'};
110             }
111              
112             sub reference {
113 4598     4598 1 3223 my $self = shift;
114 4598 100       11915 @_ ? $self->{'reference'} = shift : $self->{'reference'};
115             }
116              
117             sub obsolete {
118 3040     3040 1 2362 my $self = shift;
119 3040 100       5847 @_ ? $self->{'obsolete'} = shift : $self->{'obsolete'};
120             }
121              
122             sub fuzzy {
123 1     1 1 1 my $self = shift;
124              
125 1 50       2 if (@_) {
126 1         2 my $value = shift;
127 1 50       2 $value ? $self->add_flag('fuzzy') : $self->remove_flag('fuzzy');
128             }
129              
130 1         2 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 5775     5775   4951 my $self = shift;
147 5775 100       12524 @_ ? $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 1144     1144 1 1212 my ($self, $flag_name) = @_;
180 1144 100       1456 if (! $self->has_flag($flag_name)) {
181 1143         796 push @{$self->_flags}, $flag_name;
  1143         1268  
182             }
183 1144         3952 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 1147     1147 1 1017 my ($self, $flag_name) = @_;
198 1147         819 foreach my $flag (@{$self->_flags}) {
  1147         1269  
199 210 100       485 return 1 if $flag eq $flag_name;
200             }
201 1143         2030 return;
202             }
203              
204             sub loaded_line_number {
205 1967     1967 1 1997 my $self = shift;
206 1967 100       3122 @_ ? $self->{'loaded_line_number'} = shift : $self->{'loaded_line_number'};
207             }
208              
209             sub _normalize_str {
210 3158     3158   2266 my $self = shift;
211 3158         2338 my $string = shift;
212 3158         3267 my $dequoted = $self->dequote($string);
213              
214             # Multiline: this isn't quite perfect, but fast and easy
215 3158 100 66     9618 if (defined $dequoted && $dequoted =~ /\n/) {
216 200         148 my $output;
217             my @lines;
218 200         561 @lines = split(/\n/, $dequoted, -1);
219 200         213 my $lastline = pop @lines; # special treatment for this one
220 200 100       335 $output = qq{""\n} if ($#lines != 0);
221 200         215 foreach (@lines) {
222 353         602 $output .= $self->quote("$_\n") . "\n";
223             }
224 200 100       372 $output .= $self->quote($lastline) . "\n" if $lastline ne "";
225 200         421 return $output;
226             }
227             # Single line
228             else {
229 2958   50     6694 return ($string || "") . "\n";
230             }
231             }
232              
233             sub _fuzzy_normalize_str {
234 112     112   87 my $self = shift;
235 112         81 my $string = shift;
236 112         84 my $prefix = shift;
237              
238 112         128 my $normalized = $self->_normalize_str($string);
239              
240             # on newlines, start them with "#| " or "#~| "
241 112         159 $normalized =~ s/\n"/\n$prefix"/g;
242              
243 112         174 return $normalized;
244             }
245              
246             sub dump {
247 1513     1513 1 5429 my $self = shift;
248 1513 100       1790 my $obsolete = $self->obsolete ? '#~ ' : '';
249 1513 100       1651 my $fuzzy_prefix = $self->obsolete ? '#~| ' : '#| ';
250 1513         1069 my $dump;
251              
252 1513 100       1619 $dump = $self->_dump_multi_comment($self->comment, "# ")
253             if ($self->comment);
254 1513 100       1945 $dump .= $self->_dump_multi_comment($self->automatic, "#. ")
255             if ($self->automatic);
256 1513 100       1811 $dump .= $self->_dump_multi_comment($self->reference, "#: ")
257             if ($self->reference);
258              
259 1513         1463 my $flags = '';
260              
261 1513         1019 foreach my $flag (@{$self->_flags}) {
  1513         1684  
262 589         897 $flags .= ", $flag";
263             }
264              
265 1513 100       2460 $dump .= "#$flags\n"
266             if length $flags;
267              
268 1513 100       1762 $dump
269             .= "${fuzzy_prefix}msgctxt "
270             . $self->_fuzzy_normalize_str($self->fuzzy_msgctxt, $fuzzy_prefix)
271             if $self->fuzzy_msgctxt;
272 1513 100       1789 $dump
273             .= "${fuzzy_prefix}msgid "
274             . $self->_fuzzy_normalize_str($self->fuzzy_msgid, $fuzzy_prefix)
275             if $self->fuzzy_msgid;
276 1513 100       1715 $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 1513 100       1687 $dump .= "${obsolete}msgctxt " . $self->_normalize_str($self->msgctxt)
282             if $self->msgctxt;
283 1513         2131 $dump .= "${obsolete}msgid " . $self->_normalize_str($self->msgid);
284 1513 100       2069 $dump .= "${obsolete}msgid_plural " . $self->_normalize_str($self->msgid_plural)
285             if $self->msgid_plural;
286              
287 1513 100       1764 $dump .= "${obsolete}msgstr " . $self->_normalize_str($self->msgstr) if $self->msgstr;
288              
289 1513 100       2289 if (my $msgstr_n = $self->msgstr_n) {
290 9         41 $dump .= "${obsolete}msgstr[$_] " . $self->_normalize_str($$msgstr_n{$_})
291 9         31 for sort { $a <=> $b } keys %$msgstr_n;
292             }
293              
294 1513         1228 $dump .= "\n";
295 1513         4689 return $dump;
296             }
297              
298             sub _dump_multi_comment {
299 1494     1494   1130 my $self = shift;
300 1494         1012 my $comment = shift;
301 1494         1115 my $leader = shift;
302 1494         1100 my $chopped = $leader;
303 1494         1201 chop($chopped);
304 1494         1304 my $result = $leader . $comment;
305 1494         1389 $result =~ s/\n/\n$leader/g;
306 1494         2759 $result =~ s/^$leader$/$chopped/gm;
307 1494         1109 $result .= "\n";
308 1494         1986 return $result;
309             }
310              
311             # Quote a string properly
312             sub quote {
313 4530     4530 1 3616 my $self = shift;
314 4530         3851 my $string = shift;
315              
316             return undef
317 4530 100       6011 unless defined $string;
318              
319 4529         4460 $string =~ s/\\(?!t)/\\\\/g; # \t is a tab
320 4529         4679 $string =~ s/"/\\"/g;
321 4529         4239 $string =~ s/\n/\\n/g;
322 4529         9558 return "\"$string\"";
323             }
324              
325             sub dequote {
326 7497     7497 1 6174 my $self = shift;
327 7497         8409 my $string = shift;
328              
329             return undef
330 7497 50       9827 unless defined $string;
331              
332 7497         19154 $string =~ s/^"(.*)"/$1/;
333 7497         8415 $string =~ s/\\"/"/g;
334 7497         7176 $string =~ s/(?
335 7497         6791 $string =~ s/(?
336 7497         6232 $string =~ s/(?
337 7497         6083 $string =~ s/\\{4}n/\\\\n/g; # \ followed by inline newline
338 7497         5858 $string =~ s/\\\\(?!n)/\\/g; # all slashes not related to a newline
339 7497         11039 return $string;
340             }
341              
342             sub save_file_fromarray {
343 10     10 1 2346 my $self = shift;
344 10         49 $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 10     10   16 my $self = shift;
354 10         20 my $ashash = shift;
355 10         13 my $file = shift;
356 10         15 my $entries = shift;
357 10         32 my $encoding = shift;
358              
359 10 100       15976 open(OUT, defined($encoding) ? ">:encoding($encoding)" : ">", $file)
    50          
360             or return undef;
361 10 50       63 if ($ashash) {
362 0         0 foreach (sort keys %$entries) {
363 0         0 print OUT $entries->{$_}->dump;
364             }
365             }
366             else {
367 10         29 foreach (@$entries) {
368 1499         2126 print OUT $_->dump;
369             }
370             }
371              
372 10         566 close OUT;
373             }
374              
375             sub load_file_asarray {
376 14     14 1 1932 my $self = shift;
377 14         57 $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 14     14   17 my $self = shift;
387 14         19 my $ashash = shift;
388 14         18 my $file = shift;
389 14         21 my $encoding = shift;
390 14   33     68 my $class = ref $self || $self;
391 14         20 my (@entries, %entries);
392 14         18 my $line_number = 0;
393 14         18 my $po;
394             my %buffer;
395 0         0 my $last_buffer;
396              
397 14 100   1   431 open(IN, defined($encoding) ? "<:encoding($encoding)" : "<", $file)
  1 50       6  
  1         0  
  1         6  
398             or return undef;
399              
400 14         9146 while () {
401 9214         8011 chomp;
402 9214         6329 $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 9214         66121 s{[\r\n]*$}{};
413              
414 9214 100 100     62725 if (/^$/) {
    100          
    100          
    100          
    100          
    100          
    100          
    100          
    100          
    100          
    100          
    100          
    100          
    50          
415              
416             # Empty line. End of an entry.
417              
418 1960 50       2859 if (defined($po)) {
419 1960 100       2907 $po->fuzzy_msgctxt($buffer{fuzzy_msgctxt})
420             if defined $buffer{fuzzy_msgctxt};
421 1960 100       2923 $po->fuzzy_msgid($buffer{fuzzy_msgid}) if defined $buffer{fuzzy_msgid};
422 1960 100       2690 $po->fuzzy_msgid_plural($buffer{fuzzy_msgid_plural})
423             if defined $buffer{fuzzy_msgid_plural};
424 1960 100       2643 $po->msgctxt($buffer{msgctxt}) if defined $buffer{msgctxt};
425 1960 50       4176 $po->msgid($buffer{msgid}) if defined $buffer{msgid};
426 1960 100       3075 $po->msgid_plural($buffer{msgid_plural}) if defined $buffer{msgid_plural};
427 1960 100       4324 $po->msgstr($buffer{msgstr}) if defined $buffer{msgstr};
428 1960 100       2881 $po->msgstr_n($buffer{msgstr_n}) if defined $buffer{msgstr_n};
429              
430              
431             # ashash
432 1960 50       2215 if ($ashash) {
433 0 0       0 $entries{$po->msgid} = $po
434             if ($po->_hash_key_ok(\%entries));
435             }
436              
437             # asarray
438             else {
439 1960         2219 push(@entries, $po);
440             }
441              
442 1960         1662 undef $po;
443 1960         1303 undef $last_buffer;
444 1960         6656 %buffer = ();
445             }
446             }
447             elsif (/^#\s+(.*)/ or /^#()$/) {
448              
449             # Translator comments
450 34 100       105 $po = $class->new(-loaded_line_number => $line_number) unless defined($po);
451 34 100       67 if (defined($po->comment)) {
452 25         33 $po->comment($po->comment . "\n$1");
453             }
454             else {
455 9         25 $po->comment($1);
456             }
457             }
458             elsif (/^#\.\s*(.*)/) {
459              
460             # Automatic comments
461 914 50       3002 $po = $class->new(-loaded_line_number => $line_number) unless defined($po);
462 914 50       1260 if (defined($po->automatic)) {
463 0         0 $po->automatic($po->automatic . "\n$1");
464             }
465             else {
466 914         1114 $po->automatic($1);
467             }
468             }
469             elsif (/^#:\s+(.*)/) {
470              
471             # reference
472 1029 100       2901 $po = $class->new(-loaded_line_number => $line_number) unless defined($po);
473 1029 100       1360 if (defined($po->reference)) {
474 2         4 $po->reference($po->reference . "\n$1");
475             }
476             else {
477 1027         1196 $po->reference($1);
478             }
479             }
480             elsif (/^#,\s+(.*)/) {
481              
482             # flags
483 938         3017 my @flags = split /\s*[,]\s*/, $1;
484 938 100       1508 $po = $class->new(-loaded_line_number => $line_number) unless defined($po);
485 938         1114 foreach my $flag (@flags) {
486 1142         1731 $po->add_flag($flag);
487             }
488             }
489             elsif (/^#(~)?\|\s+msgctxt\s+(.*)/) {
490 1 50       4 $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       4 $po->obsolete(1) if $1;
494             }
495             elsif (/^#(~)?\|\s+msgid\s+(.*)/) {
496 206 50       358 $po = $class->new(-loaded_line_number => $line_number) unless defined($po);
497 206         352 $buffer{fuzzy_msgid} = $self->dequote($2);
498 206         243 $last_buffer = \$buffer{fuzzy_msgid};
499 206 100       1041 $po->obsolete(1) if $1;
500             }
501             elsif (/^#(~)?\|\s+msgid_plural\s+(.*)/) {
502 1 50       2 $po = $class->new(-loaded_line_number => $line_number) unless defined($po);
503 1         2 $buffer{fuzzy_msgid_plural} = $self->dequote($2);
504 1         1 $last_buffer = \$buffer{fuzzy_msgid_plural};
505 1 50       5 $po->obsolete(1) if $1;
506             }
507             elsif (/^(#~\s+)?msgctxt\s+(.*)/) {
508 4 50       10 $po = $class->new(-loaded_line_number => $line_number) unless defined($po);
509 4         8 $buffer{msgctxt} = $self->dequote($2);
510 4         4 $last_buffer = \$buffer{msgctxt};
511 4 50       27 $po->obsolete(1) if $1;
512             }
513             elsif (/^(#~\s+)?msgid\s+(.*)/) {
514 1965 100       3096 $po = $class->new(-loaded_line_number => $line_number) unless defined($po);
515 1965         3103 $buffer{msgid} = $self->dequote($2);
516 1965         2009 $last_buffer = \$buffer{msgid};
517 1965 100       7462 $po->obsolete(1) if $1;
518             }
519             elsif (/^(#~\s+)?msgid_plural\s+(.*)/) {
520 5 50       10 $po = $class->new(-loaded_line_number => $line_number) unless defined($po);
521 5         7 $buffer{msgid_plural} = $self->dequote($2);
522 5         5 $last_buffer = \$buffer{msgid_plural};
523 5 100       18 $po->obsolete(1) if $1;
524             }
525             elsif (/^(?:#~\s+)?msgstr\s+(.*)/) {
526              
527             # translated string
528 1959         2937 $buffer{msgstr} = $self->dequote($1);
529 1959         5460 $last_buffer = \$buffer{msgstr};
530             }
531             elsif (/^(?:#~\s+)?msgstr\[(\d+)\]\s+(.*)/) {
532              
533             # translated string
534 10         17 $buffer{msgstr_n}{$1} = $self->dequote($2);
535 10         27 $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 188         295 $$last_buffer .= $self->dequote($1);
545             }
546             else {
547 0         0 warn "Strange line at $file line $line_number: [$_]\n";
548             }
549             }
550 14 100       43 if (defined($po)) {
551              
552 5 50       14 $po->msgctxt($buffer{msgctxt})
553             if defined $buffer{msgctxt};
554 5 50       30 $po->msgid($buffer{msgid})
555             if defined $buffer{msgid};
556 5 50       19 $po->msgid_plural($buffer{msgid_plural})
557             if defined $buffer{msgid_plural};
558 5 50       22 $po->msgstr($buffer{msgstr})
559             if defined $buffer{msgstr};
560 5 50       15 $po->msgstr_n($buffer{msgstr_n})
561             if defined $buffer{msgstr_n};
562              
563             # ashash
564 5 50       13 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 5         8 push(@entries, $po);
573             }
574             }
575 14         262 close IN;
576 14 50       99 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__