|
69 | 69 | } |
70 | 70 |
|
71 | 71 | ## A message |
72 | | - if ($line =~ /^(\s*)'([\w\-]+)'\s+=> (qq?)\{(.+?)}[,.](.*)/) { |
| 72 | + if ($line =~ /^(\s*)'([\w\-]+)'\s*=> (qq?)\{(.+?)}[,.](.*)/) { |
73 | 73 | my ($space,$msg,$quote,$value,$comment) = (length $1 ? 1 : 0, $2, $3, $4, $5); |
74 | 74 | $msg{$lang}{$msg} = [$space,$value,$quote,$comment]; |
75 | 75 | if ($lang eq 'en' and $msg =~ /\-po\d*$/) { |
|
90 | 90 | for my $tr (sort keys %trans) { |
91 | 91 | my $val = $trans{$tr}; |
92 | 92 | if ($mm =~ /^$val/) { |
93 | | - $nn =~ s/(.+?)\s*\%.*/$1/; |
| 93 | + $nn =~ s/(.+?)\s*\%.*/$1/; # remove everything from % on |
| 94 | + print "$tr/$ll: $val -> $nn\n"; |
94 | 95 | length $nn and $msg{$ll}{$tr} = [1,$nn,'q','']; |
95 | 96 | } |
96 | 97 | } |
|
106 | 107 | last if $line =~ /^our \%msg/; |
107 | 108 | } |
108 | 109 |
|
| 110 | +my %all_langs = map { $_ => 1} (keys %msg, keys %po); |
| 111 | + |
109 | 112 | ## Add in the translated sections, with new info as needed |
110 | 113 | for my $m (sort { |
111 | 114 | ## English goes first, as the base class |
112 | 115 | return -1 if $a eq 'en'; return 1 if $b eq 'en'; |
113 | | - ## French goes next, as the next-most-completed language |
| 116 | + ## Then the fully translated languages |
| 117 | + return -1 if $a eq 'es'; return 1 if $b eq 'es'; |
114 | 118 | return -1 if $a eq 'fr'; return 1 if $b eq 'fr'; |
115 | 119 | ## Everything else is alphabetical |
116 | 120 | return $a cmp $b |
117 | | -} keys %po) { |
| 121 | +} keys %all_langs) { |
118 | 122 | print {$fh} qq!'$m' => {\n!; |
119 | | - my $size = 1; |
| 123 | + my $size = 14; # length of "checkpoint-po" + 1 |
120 | 124 | for my $msg (keys %{$msg{$m}}) { |
121 | 125 | $size = length($msg) if length($msg) > $size; |
122 | 126 | } |
123 | 127 |
|
124 | 128 | for my $mm (sort keys %{$msg{$m}}) { |
125 | | - printf {$fh} "%s%-*s => %s{%s},%s\n", |
126 | | - $msg{$m}{$mm}->[0] ? "\t" : '', |
| 129 | + printf {$fh} "%s%-*s=> %s{%s},%s\n", |
| 130 | + $msg{$m}{$mm}->[0] ? " " : '', |
127 | 131 | 2+$size, |
128 | 132 | qq{'$mm'}, |
129 | 133 | $msg{$m}{$mm}->[2], |
@@ -183,7 +187,7 @@ sub process_po_files { |
183 | 187 | $isid = 0; |
184 | 188 | } |
185 | 189 | elsif (/^"(.*)"/) { |
186 | | - $isid ? ($id .= $1) : ($po{$lang}{$id} .= $1); |
| 190 | + $isid ? ($id .= $1) : ($panda->{$lang}{$id} .= $1); |
187 | 191 | } |
188 | 192 | } |
189 | 193 | close $fh or warn qq{Could not close "$pofile" $!\n}; |
|
0 commit comments