From: Bob Stayton Date: Wed, 17 Jul 2002 07:49:47 +0000 (+0000) Subject: Perl script to compare any or all locale files to X-Git-Tag: release/1.79.1~6^2~5399 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3f82137148dfa917059562d26b48f92f5111ad8a;p=docbook-dsssl Perl script to compare any or all locale files to the en.xml locale file, so diffs can be detected and corrected. --- diff --git a/gentext/locale/Auditlocale.pl b/gentext/locale/Auditlocale.pl new file mode 100755 index 000000000..80a88f5a9 --- /dev/null +++ b/gentext/locale/Auditlocale.pl @@ -0,0 +1,104 @@ +#!/usr/bin/perl + +# Script to compare the English locale file to any +# or all other locale files to see what is missing +# or extra. + +$USAGE = "\n$0 ??.xml [...] + + where ??.xml is a non-English locale file. + Report written to standard output showing what + templates are missing or extra. + You can feed it more than one, or *.xml for all. + +"; + +if ( scalar(@ARGV) < 1 ) { + print "$USAGE"; + exit 0; +} + +open MASTER, ") { + if ( /(.*?)| ) { + $mastertemplate{$context}{$1} = $2; + } +} + +for $input ( @ARGV ) { + open INPUT, "<$input"; + while() { + if ( /(.*?)| ) { + $template{$context}{$1} = $2; + } + } + close INPUT; + + print "###########################################\n"; + print "### $input \n"; + print "###########################################\n"; + # scan through master to see if missing in the other + print "=========================== gentext \n"; + foreach my $name ( @mastergentext ) { + unless ( grep /^$name$/, @gentext ) { + print "Missing gentext $name\n"; + } + } + print "=========================== dingbat \n"; + foreach my $name ( @masterdingbat ) { + unless ( grep /^$name$/, @dingbat ) { + print "Missing dingbat $name\n"; + } + } + foreach my $context (@contexts) { + print "=========================== context $context \n"; + foreach my $name ( keys %{ $mastertemplate{$context} } ) { + unless ( $template{$context}{$name} ) { + print "Missing template $name = $mastertemplate{$context}{$name}\n"; + } + } + foreach my $name ( keys %{ $template{$context} } ) { + unless ( $mastertemplate{$context}{$name} ) { + print "Extra template not in master $name = $template{$context}{$name}\n"; + } + } + } + # scan through other to see if missing in master + foreach my $name ( @gentext ) { + unless ( grep /^$name$/, @mastergentext ) { + print "Extra gentext not in master: $name\n"; + } + } + foreach my $name ( @dingbat ) { + unless ( grep /^$name$/, @masterdingbat ) { + print "Extra dingbat not in master: $name\n"; + } + } +}