4 # Verify that keys used in Java files are present in the translation file.
7 # verifyTranslationKeys.pl <property file> <Java files...>
10 # find src/ -name "*.java" -exec ./scripts/verifyTranslationKeys.pl l10n/messages.properties {} +
15 # Read the translation file
17 print "Reading translation keys...\n";
19 if ($ARGV!~/\.properties/) {
23 if ($str=~/^\s*($|[#!])/) {
27 if ($str=~/^([a-zA-Z0-9._-]+)\s*=/) {
30 print "ERROR: Invalid line in $ARGV: $str";
38 print "Reading Java files...\n";
42 if ($ARGV != $oldFile) {
46 # Check for irregular translator definition (exclude /l10n/ and /startup/)
47 if ($str =~ / Translator / &&
48 $str !~ /private static final Translator trans = Application.getTranslator\(\);/ &&
49 $ARGV !~ /\/(l10n|startup)\//) {
50 print "ERROR: Unusual translator usage in file $ARGV: $str";
53 # Check for new class definition
54 if ($str =~ /^[\sa-z]*class ([a-zA-Z0-9]+) /) {
58 # Check for translator usage
59 if ($str =~ /trans\.get\(\"([^\"]+)\"\)/) {
61 if (!(exists $keys{$key}) &&
62 !(exists $keys{$class . "." . $key})) {
63 print "ERROR: Missing translation for '$key' in file $ARGV\n";