chiark / gitweb /
translation status checking tool, based on documentation/doc-check
authoraph <aph@313b444b-1b9f-4f58-a734-7bb04f332e8d>
Fri, 6 Dec 2002 09:49:33 +0000 (09:49 +0000)
committeraph <aph@313b444b-1b9f-4f58-a734-7bb04f332e8d>
Fri, 6 Dec 2002 09:49:33 +0000 (09:49 +0000)
from boot-floppies source, rev 1.12

git-svn-id: svn://anonscm.debian.org/ddp/manuals/trunk/developers-reference@1950 313b444b-1b9f-4f58-a734-7bb04f332e8d

translation-status [new file with mode: 0755]

diff --git a/translation-status b/translation-status
new file mode 100755 (executable)
index 0000000..71400b7
--- /dev/null
@@ -0,0 +1,79 @@
+#!/usr/bin/perl -w
+
+# This script checks if the translations of the documents are up to date.
+# When called with "-d" option, it also prints what has changed in the
+# original since last translation
+
+# SYNOPSIS:
+#             ./doc-check [-d] [-v] [-V] [lang]
+#
+#      (uses $lang set below if lang is not given on commandline)
+
+use Getopt::Std;
+$opt_d = $opt_v = $opt_V = 0;
+getopts('dvV');
+# You may set this to your default language code
+$lang = shift || "pl";
+
+sub checkdiff
+{
+       my ($plfname, $enfname) = (@_);
+       my ($plrev, $enrev) = getrev($plfname, $enfname);
+       $plrev and $enrev or return;
+       if ( "$plrev" ne "$enrev" ) {
+               if ($opt_d) {
+                       my $s = "cvs diff -b -u -r $plrev -r $enrev $enfname";
+                       warn "running $s:\n" if ($opt_V);
+                       system($s);
+               } else {
+                       print "$enfname : $plrev -> $enrev\n";
+               }
+       }
+}
+
+sub getrev
+{
+       my ($plfname, $enfname) = (@_);
+       my ($plrev, $enrev) = (0, 0);
+
+       warn "checking $plfname:\n" if $opt_v;
+       open FILE, $plfname or warn "$plfname: $!\n" and return;
+       while (<FILE>) {
+               if (/<!--\s*original version\D*([\d\.]+)\s*-->/) {
+                       $plrev = $1;
+                       last;
+               }
+               if (/<!--\s*original document: en\/\S+, revision ([\d\.]+)\s*-->/) {
+                       $plrev = $1;
+                       last;
+               }
+       }
+       warn "checking $enfname:\n" if $opt_v;
+       open FILE, $enfname or warn "$enfname: $!\n" and return;
+       while (<FILE>) {
+               if (/\$Id: [^\s]+ ([\d\.]+) .* Exp \$/) {
+                       $enrev = $1;
+                       last;
+               }
+               if (/\$Revision: ([\d\.]+) \$/) {
+                       $enrev = $1;
+                       last;
+               }
+       }
+       close FILE;
+       warn "failed to find revision for $plfname\n" unless $plrev;
+       warn "failed to find revision for $enfname\n" unless $enrev;
+       return ($plrev, $enrev);
+}
+
+@subdocs = ("welcome", "hardware", "preparing", "inst-methods", "rescue-boot", "partitioning", "kernel", "boot-new", "post-install", "tech-info", "appendix", "administrivia");
+
+foreach $doc (@subdocs) {
+       my $plfname = "$lang/" . "$doc" . ".sgml";
+       my $enfname = "en/" . "$doc" . ".sgml";
+       checkdiff($plfname, $enfname);
+}
+checkdiff("install.$lang.sgml", "install.sgml");
+checkdiff("release-notes.$lang.sgml","release-notes.sgml");
+checkdiff("index.$lang.html.m4","index.en.html.m4");
+checkdiff("dselect-beginner.$lang.sgml","dselect-beginner.sgml");