From e913fa090e64c64542cbf646b0c9d57c2e66053e Mon Sep 17 00:00:00 2001 From: Rich Bowen Date: Fri, 26 Nov 2010 14:41:00 +0000 Subject: [PATCH] Script to evaluate translations and tell us useful things like what directives are missing. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1039389 13f79535-47bb-0310-9956-ffa450edef68 --- docs/review_translations.pl | 65 +++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100755 docs/review_translations.pl diff --git a/docs/review_translations.pl b/docs/review_translations.pl new file mode 100755 index 0000000000..bd9a289d2a --- /dev/null +++ b/docs/review_translations.pl @@ -0,0 +1,65 @@ +#!/opt/local/bin/perl +use XML::Simple; +use Getopt::Std; +use File::Glob; +use Data::Dumper; +use strict; + +our ( $opt_m, $opt_x ); +our $VERSION = '0.01'; +our %LANGS = ( + 'fr' => 'French', + ); + +getopt("m:"); +HELP_MESSAGE() unless $opt_m; + +my $eng = $opt_m . '.xml'; +my @files = glob $opt_m . '.xml.*'; + +my $xs = XML::Simple->new(); +my $eng_xml = $xs->XMLin( $eng ); + +print "This document defines the following directives:\n"; +my @directives; +foreach my $directive ( keys %{ $eng_xml->{directivesynopsis} } ) { + push @directives, $directive; + print $directive . "\n"; +} +print "\n"; + +foreach my $file (@files) { + next if $file =~ m/\.meta$/; + my $lang = $file; + $lang =~ s/.*\.([^.]+)$/$1/; + print "Translation available in ". ($LANGS{$lang}?$LANGS{$lang}:$lang) ."\n"; + my $lang_xml = $xs->XMLin( $file ); + + foreach my $d ( @directives ) { + print "Translation does not define $d\n" unless defined( $lang_xml->{directivesynopsis}->{$d} ); + } + + print "\n\n"; +} + + +sub HELP_MESSAGE { + print STDERR qq~ + +Usage: + +cd manual/mod +../../review_translations.pl -m mod_rewrite + +Lists languages with available translations, and tells you what +directives are missing from each translation. + +-m mod_foo - Run for mod_foo. + +-x - Generate XML for missing directives, to be pasted into the +translation XML. + +~; +} + + -- 2.40.0