From a2c790cb659d425284a524ce8dfd748dbc84f511 Mon Sep 17 00:00:00 2001 From: aph Date: Fri, 6 Dec 2002 09:49:33 +0000 Subject: [PATCH] translation status checking tool, based on documentation/doc-check 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 | 79 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100755 translation-status diff --git a/translation-status b/translation-status new file mode 100755 index 0000000..71400b7 --- /dev/null +++ b/translation-status @@ -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 () { + if (//) { + $plrev = $1; + last; + } + if (//) { + $plrev = $1; + last; + } + } + warn "checking $enfname:\n" if $opt_v; + open FILE, $enfname or warn "$enfname: $!\n" and return; + while () { + 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"); -- 2.30.2