Changeset 26338 in osm for applications/editors
- Timestamp:
- 2011-07-15T23:05:41+02:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/i18n/i18n.pl
r26174 r26338 198 198 $str =~ s/\\n/\n/g; 199 199 $str = encode("utf8", $str); 200 return pack("n",length($str)).$str; 200 return $str; 201 } 202 203 sub checkstring 204 { 205 my ($la, $tr, $en, $cnt, $en1) = @_; 206 $tr = makestring($tr); 207 $en = makestring($en); 208 $en1 = makestring($en1) if defined($en1); 209 my $error = 0; 210 211 # Test one - are there single quotes which don't occur twice 212 my $v = $tr; 213 $v =~ s/''//g; # replace all twice occuring single quotes 214 if($v =~ /'/) 215 { 216 #warn "JAVA translation issue for language $la: Mismatching single quotes:\nTranslated text: $tr\n"; 217 #$error = 1; 218 } 219 # Test two - check if there are {..} which should not be 220 my @fmt = (); 221 my $fmt; 222 my $fmte; 223 my $fmte1 = ""; 224 while($tr =~ /\{(.*?)\}/g) {push @fmt,$1}; $fmt = join("_", sort @fmt); @fmt = (); 225 while($en =~ /\{(.*?)\}/g) {push @fmt,$1}; $fmte = join("_", sort @fmt); @fmt = (); 226 if($en1) {while($en1 =~ /\{(.*?)\}/g) {push @fmt,$1}; $fmte1 = join("_", sort @fmt);} 227 if($fmt ne $fmte && $fmt ne $fmte1) 228 { 229 if(!($fmte eq '0' && $fmt eq "" && $cnt == 1)) # Don't warn when a single value is left for first multi-translation 230 { 231 $cnt == $cnt || 0; 232 warn "JAVA translation issue for language $la ($cnt): Mismatching format entries:\nTranslated text: $tr\nOriginal text: $en\n"; 233 $error = 1; 234 } 235 } 236 237 #$tr = "" if($error && $la ne "en"); 238 239 return pack("n",length($tr)).$tr; 201 240 } 202 241 … … 243 282 $val = "" if($ennoctx eq $val); 244 283 } 245 print FILE makestring($val);284 print FILE checkstring($la, $val, $en); 246 285 } 247 286 print FILE pack "n",0xFFFF; … … 275 314 if($num) 276 315 { 277 print FILE makestring($val);316 print FILE checkstring($la, $val, $en, 1, $data->{$en}{"en.1"}); 278 317 for($num = 1; exists($data->{$en}{"$la.$num"}); ++$num) 279 318 { 280 print FILE makestring($data->{$en}{"$la.$num"});319 print FILE checkstring($la, $data->{$en}{"$la.$num"}, $en, $num+1, $data->{$en}{"en.1"}); 281 320 } 282 321 }
Note:
See TracChangeset
for help on using the changeset viewer.