Changeset 153980 in webkit
- Timestamp:
- Aug 12, 2013 11:26:29 PM (11 years ago)
- Location:
- trunk/Tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r153977 r153980 1 2013-08-12 Dan Bernstein <mitz@apple.com> 2 3 extract-localizable-strings output is not suited for parsing by Xcode 4 https://bugs.webkit.org/show_bug.cgi?id=119728 5 6 Reviewed by Darin Adler. 7 8 Added spaces where needed after “path:line:” to allow Xcode to recognize the file reference, 9 removed “ERROR” since messages that refer to a line in a file are shown as error by default, 10 added “warning: ” in messages that aren’t errors (i.e. don’t prevent the script from exiting 11 with 0). 12 13 * Scripts/extract-localizable-strings: 14 1 15 2013-08-12 Ryuan Choi <ryuan.choi@samsung.com> 2 16 -
trunk/Tools/Scripts/extract-localizable-strings
r153976 r153980 96 96 if (/^"([^\\"]|\\.)*"$/ or /^[-_\/\w\s.]+.(h|m|mm|c|cpp)$/ or /^[-_\/\w\s.]+.(h|m|mm|c|cpp):"([^\\"]|\\.)*"$/) { 97 97 if ($exception{$_}) { 98 print "$exceptionsFile:$.: exception for $_ appears twice\n";99 print "$exceptionsFile:$exception{$_}: first appearance\n";98 print "$exceptionsFile:$.: warning: exception for $_ appears twice\n"; 99 print "$exceptionsFile:$exception{$_}: warning: first appearance\n"; 100 100 } else { 101 101 $exception{$_} = $.; 102 102 } 103 103 } else { 104 print "$exceptionsFile:$.: syntax error\n";104 print "$exceptionsFile:$.: warning: syntax error\n"; 105 105 } 106 106 } … … 152 152 if ($token eq "\"") { 153 153 if ($expected and $expected ne "a quoted string") { 154 print "$file:$.: ERROR:found a quoted string but expected $expected\n";154 print "$file:$.: found a quoted string but expected $expected\n"; 155 155 $sawError = 1; 156 156 $expected = ""; … … 164 164 } 165 165 } else { 166 print "$file:$.: ERROR:mismatched quotes\n";166 print "$file:$.: mismatched quotes\n"; 167 167 $sawError = 1; 168 168 $_ = ""; … … 203 203 $usedException{"$file:\"$string\""} = 1; 204 204 } else { 205 print "$file:$stringLine: \"$string\" is not marked for localization\n" if $warnAboutUnlocalizedStrings;205 print "$file:$stringLine: warning: \"$string\" is not marked for localization\n" if $warnAboutUnlocalizedStrings; 206 206 $notLocalizedCount++; 207 207 } … … 214 214 215 215 if ($token =~ /^NSLocalized/ && $token !~ /NSLocalizedDescriptionKey/ && $token !~ /NSLocalizedStringFromTableInBundle/ && $token !~ /NSLocalizedFileSizeDescription/) { 216 print "$file:$.: ERROR:found a use of an NSLocalized macro ($token); not supported\n";216 print "$file:$.: found a use of an NSLocalized macro ($token); not supported\n"; 217 217 $nestingLevel = 0 if !defined $nestingLevel; 218 218 $sawError = 1; … … 227 227 } elsif ($token eq "'") { 228 228 if (!s-([^\\]|\\.)'--) { #' <-- that single quote makes the Project Builder editor less confused 229 print "$file:$.: ERROR:mismatched single quote\n";229 print "$file:$.: mismatched single quote\n"; 230 230 $sawError = 1; 231 231 $_ = ""; … … 233 233 } else { 234 234 if ($expected and $expected ne $token) { 235 print "$file:$.: ERROR:found $token but expected $expected\n";235 print "$file:$.: found $token but expected $expected\n"; 236 236 $sawError = 1; 237 237 $expected = ""; … … 269 269 270 270 if ($expected) { 271 print "$file: ERROR:reached end of file but expected $expected\n";271 print "$file: reached end of file but expected $expected\n"; 272 272 $sawError = 1; 273 273 } … … 311 311 $string = UnescapeHexSequence($string); 312 312 if (!defined($string)) { 313 print "$file:$line: ERROR:string has an illegal hexadecimal escape sequence\n";313 print "$file:$line: string has an illegal hexadecimal escape sequence\n"; 314 314 $bad = 1; 315 315 } 316 316 $key = UnescapeHexSequence($key); 317 317 if (!defined($key)) { 318 print "$file:$line: ERROR:key has an illegal hexadecimal escape sequence\n";318 print "$file:$line: key has an illegal hexadecimal escape sequence\n"; 319 319 $bad = 1; 320 320 } 321 321 $comment = UnescapeHexSequence($comment); 322 322 if (!defined($comment)) { 323 print "$file:$line: ERROR:comment has an illegal hexadecimal escape sequence\n";323 print "$file:$line: comment has an illegal hexadecimal escape sequence\n"; 324 324 $bad = 1; 325 325 } 326 326 if (grep { $_ == 0xFFFD } unpack "U*", $string) { 327 print "$file:$line: ERROR:string for translation has illegal UTF-8 -- most likely a problem with the Text Encoding of the source file\n";327 print "$file:$line: string for translation has illegal UTF-8 -- most likely a problem with the Text Encoding of the source file\n"; 328 328 $bad = 1; 329 329 } 330 330 if ($string ne $key && grep { $_ == 0xFFFD } unpack "U*", $key) { 331 print "$file:$line: ERROR:key has illegal UTF-8 -- most likely a problem with the Text Encoding of the source file\n";331 print "$file:$line: key has illegal UTF-8 -- most likely a problem with the Text Encoding of the source file\n"; 332 332 $bad = 1; 333 333 } 334 334 if (grep { $_ == 0xFFFD } unpack "U*", $comment) { 335 print "$file:$line: ERROR:comment for translation has illegal UTF-8 -- most likely a problem with the Text Encoding of the source file\n";335 print "$file:$line: comment for translation has illegal UTF-8 -- most likely a problem with the Text Encoding of the source file\n"; 336 336 $bad = 1; 337 337 } … … 342 342 343 343 if ($stringByKey{$key} && $stringByKey{$key} ne $string) { 344 print "$file:$line: encountered the same key, \"$key\", twice, with different strings\n";345 print "$fileByKey{$key}:$lineByKey{$key}: previous occurrence\n";344 print "$file:$line: warning: encountered the same key, \"$key\", twice, with different strings\n"; 345 print "$fileByKey{$key}:$lineByKey{$key}: warning: previous occurrence\n"; 346 346 $keyCollisionCount++; 347 347 return; 348 348 } 349 349 if ($commentByKey{$key} && $commentByKey{$key} ne $comment) { 350 print "$file:$line: encountered the same key, \"$key\", twice, with different comments\n";351 print "$fileByKey{$key}:$lineByKey{$key}: previous occurrence\n";350 print "$file:$line: warning: encountered the same key, \"$key\", twice, with different comments\n"; 351 print "$fileByKey{$key}:$lineByKey{$key}: warning: previous occurrence\n"; 352 352 $keyCollisionCount++; 353 353 return; … … 365 365 if (@unusedExceptions) { 366 366 for my $unused (@unusedExceptions) { 367 print "$exceptionsFile:$exception{$unused}: exception $unused not used\n";367 print "$exceptionsFile:$exception{$unused}: warning: exception $unused not used\n"; 368 368 } 369 369 print "\n"; … … 397 397 398 398 my $lastComment; 399 my $line; 399 400 400 401 while (<STRINGS>) { … … 409 410 my $string = delete $stringByKey{$1}; 410 411 if (!defined $string) { 411 print " error: $fileToUpdate containsunused key \"$1\" (preceding comment: /* $lastComment */)\n";412 print "$fileToUpdate:$.: unused key \"$1\" (preceding comment: /* $lastComment */)\n"; 412 413 $sawError = 1; 413 414 } else { 414 415 if (!($string eq $2)) { 415 print " error: $fileToUpdate containsunexpected value \"$2\" for key \"$1\" (expected \"$string\")\n";416 print "$fileToUpdate:$.: unexpected value \"$2\" for key \"$1\" (expected \"$string\")\n"; 416 417 $sawError = 1; 417 418 } 418 419 if (!($lastComment eq $commentByKey{$1})) { 419 print "error: $fileToUpdate contains unexpected comment /* $lastComment */ for key \"$1\" (expected /* $commentByKey{$1} */)\n"; 420 print "$fileToUpdate:$.: unexpected comment /* $lastComment */ for key \"$1\" (expected /* $commentByKey{$1} */)\n"; 421 $sawError = 1; 420 422 } 421 423 } 422 424 } else { 423 print " error: $fileToUpdate containsline with unexpected format: $_\n";425 print "$fileToUpdate:$.: line with unexpected format: $_\n"; 424 426 $sawError = 1; 425 427 } … … 427 429 428 430 for my $missing (keys %stringByKey) { 429 print " error: $fileToUpdate ismissing key \"$missing\"\n";431 print "$fileByKey{$missing}:$lineByKey{$missing}: missing key \"$missing\"\n"; 430 432 $sawError = 1; 431 433 } 432 434 433 435 if ($sawError) { 434 print "\n error: $fileToUpdate is not up to date.\n";436 print "\n$fileToUpdate:0: file is not up to date.\n"; 435 437 exit 1; 436 438 } 437 439 } 438 440 } else { 439 print " $fileToUpdate does not exist\n";441 print "error: $fileToUpdate does not exist\n"; 440 442 exit 1; 441 443 }
Note: See TracChangeset
for help on using the changeset viewer.