aboutsummaryrefslogtreecommitdiffstats
path: root/check_desc_trans.pl
diff options
context:
space:
mode:
authorPeter Karlsson <peterk>2003-08-04 19:08:45 +0000
committerPeter Karlsson <peterk>2003-08-04 19:08:45 +0000
commitdb0be7ed7319e2df1cf842442484e187d065f0fa (patch)
treeeedc4128a5db72440a42e603c78955c5e6137e29 /check_desc_trans.pl
parenta44a44304cd66b4d06e2bd326ae6ea467fc73646 (diff)
Moved my script for checking the uptodatedness of mailing list descriptions
into the top-level directory since others have expressed interest in it. Also updated it to look at the DWWW_LANG environment variable (thanks Gerfried) and to be a bit more lenient on the syntax of the translation-check files. CVS version numbers check_desc_trans.pl: INITIAL -> 1.1 swedish/MailingLists/desc/check_desc_trans.pl: 1.3 -> 1.4(DEAD)
Diffstat (limited to 'check_desc_trans.pl')
-rwxr-xr-xcheck_desc_trans.pl136
1 files changed, 136 insertions, 0 deletions
diff --git a/check_desc_trans.pl b/check_desc_trans.pl
new file mode 100755
index 00000000000..94d911cdb25
--- /dev/null
+++ b/check_desc_trans.pl
@@ -0,0 +1,136 @@
+#!/usr/bin/perl -w
+
+# Check translation status for mailing list descriptions. Since these files
+# aren't WML files, the translation data is stored in a separate file in
+# each directory, listing the names of the files and the corresponding
+# English version.
+#
+# Since I couldn't figure out how to add this to the regular check_trans.pl
+# script, this is a separate script.
+#
+# To use this script, create a file called translation-check in each
+# directory under <language>/MailingLists/desc/. In it you list the name of
+# the translated file and the version of the English original, separated by
+# whitespace. Then run this script, and it will tell you about which files
+# are missing, which files are outdated, and if there are files translating
+# files that are no longer in the English directory.
+#
+# There are no command line parameters.
+
+# Originally written 2002-10-05 by Peter Karlsson <peterk@debian.org>
+# © Copyright 2002-2003 Software in the public interest, Inc.
+# This program is released under the GNU General Public License, v2.
+
+# $Id$
+
+# Get configuration
+if (exists $ENV{DWWW_LANG})
+{
+ $language = $ENV{DWWW_LANG};
+}
+elsif (open CONF, "<language.conf")
+{
+ while (<CONF>)
+ {
+ next if /^#/;
+ chomp;
+ $language = $_, next unless defined $language;
+ }
+}
+
+die "Language not defined in DWWW_LANG or language.conf\n"
+ unless defined $language;
+
+# Counter
+$old = 0;
+$uptodate = 0;
+$unknown = 0;
+
+# Start-up
+$directory = 'MailingLists/desc';
+&process($directory);
+
+# Results
+print $old, " need to be updated.\n" if $old;
+print $uptodate, " are up to date.\n" if $uptodate;
+print $unknown, " are orphaned.\n" if $unknown;
+
+sub process
+{
+ my $curdir = shift;
+ my $source = 'english/' . $curdir;
+ my $destination = $language . '/' . $curdir;
+
+ my %sourcefile;
+ my @subdirs;
+
+ print "Checking $curdir\n";
+
+ # Read the Entries file for the source directory
+ open CVS, $source . '/CVS/Entries'
+ or die "Cannot read $source/CVS/Entries: $!\n";
+
+ while (<CVS>)
+ {
+ next if /README/;
+ if (m[^/([^/]+)/([0-9\.]+)/])
+ {
+ $sourcefile{$1} = $2;
+ }
+ elsif (m[^D/([^/]+)/])
+ {
+ push @subdirs, $1;
+ }
+ }
+ close CVS;
+
+ # Read the translation-check file for the destination directory
+ if (open CHECK, $destination . '/translation-check')
+ {
+ # Get data for the entries and compare
+ while (<CHECK>)
+ {
+ if (/^([^\s]+)\s*([0-9\.]+)$/)
+ {
+ print "Ghost entry $destination/$1\n"
+ unless -f "$destination/$1";
+ if (defined $sourcefile{$1})
+ {
+ my ($file, $oldrev, $newrev) = ($1, $2, $sourcefile{$1});
+ if ($oldrev ne $newrev)
+ {
+ $old ++;
+ print "Need to update $destination/$file from ",
+ $oldrev, " to ", $newrev, "\n";
+ }
+ else
+ {
+ $uptodate ++;
+ }
+ delete $sourcefile{$1};
+ }
+ else
+ {
+ print "Unknown translated file: $destination/$1\n";
+ $unknown ++;
+ }
+ }
+ }
+ foreach $untranslated (keys %sourcefile)
+ {
+ print "Untranslated file: $destination/$untranslated ",
+ $sourcefile{$untranslated}, "\n";
+ }
+ }
+ else
+ {
+ warn "Cannot read $destination/translation-check: $!\nDirectory skipped\n";
+ }
+
+
+ # Process subdirs
+ foreach $subdir (@subdirs)
+ {
+ &process($curdir . '/' . $subdir);
+ }
+}

© 2014-2024 Faster IT GmbH | imprint | privacy policy