3
# This script checks if the translations of the documents are up to date.
4
# When called with "-d" option, it also prints what has changed in the
5
# original since last translation.
6
# If the "-r" option is used with the "-d" option, the diff will be taken
7
# against the revision number specified with the -r option instead of
8
# the latest revision of the English original.
9
# When called with "-s" option, it also shows all files that are marked
13
# ./doc-check [-d] [-r <revision>] [-s] [-v] [-V] [lang]
15
# (uses $lang set below if lang is not given on commandline)
19
$opt_d = $opt_r = $opt_s = $opt_v = $opt_V = 0;
21
# You may set this to your default language code
22
$lang = shift || "pl";
23
if ($opt_r and $opt_r !~ /[0-9]+/) {
24
warn "Please enter a revision number for parameter -r.\n";
30
my ($plfname, $enfname) = (@_);
31
my ($plrev, $enrev, $untrans) = getrev($plfname, $enfname);
32
$plrev and $enrev or return;
33
if ( "$plrev" ne "$enrev" ) {
34
if ($opt_d and $opt_r and $opt_r < $enrev) {
38
print "$enfname : $plrev -> $enrev (untranslated)\n";
40
print "$enfname : $plrev -> $enrev\n";
43
my $s = "svn diff -r $plrev:$enrev $enfname";
44
warn "running $s:\n" if ($opt_V);
48
if ($untrans && $opt_s) {
49
print "$plfname: untranslated\n";
56
my ($plfname, $enfname) = (@_);
57
my ($plrev, $enrev, $untrans, $notconverted) = (0, 0, 0, 0);
59
warn "checking $plfname:\n" if $opt_v;
60
open FILE, $plfname or warn "$plfname: $!\n" and return;
62
if (/<!--\s*original version\D*([\d\.]+)\s*-->/) {
66
if (/<!--\s*original version\D*(\d+)\s*untranslated\s*-->/) {
71
# Also check for revision comments of original documents
72
if (/<!--\s*\$Id: \S+ (\d+) /) {
78
# Also support CVS style revision comments (depreciated)
79
if (/<!--\s*original document: en\/\S+, revision ([\d\.]+)\s*-->/) {
84
warn "checking $enfname:\n" if $opt_v;
85
open FILE, $enfname or warn "$enfname: $!\n" and return;
87
if (/\$Id: \S+ (\d+) /) {
91
# Also support CVS style revision comments (depreciated)
92
if (/\$Revision: (\d+) \$/) {
98
warn "failed to find revision for $plfname\n" unless $plrev;
99
warn "failed to find revision for $enfname\n" unless $enrev;
101
warn "$plfname: contains revision comment for original document\n";
102
warn " use 'rev-update' to convert\n";
104
return ($plrev, $enrev, $untrans);
109
my $enfname = $File::Find::name;
110
return unless $enfname =~ m/\.xml$/;
111
my $plfname = $enfname;
112
$plfname =~ s,^en/,$lang/,;
113
checkdiff($plfname, $enfname);
115
File::Find::find({ wanted => \&process, no_chdir => 1 }, 'en');
116
#checkdiff("build/install.$lang.xml", "build/install.en.xml");
117
#checkdiff("release-notes.$lang.sgml","release-notes.sgml");
118
#checkdiff("index.$lang.html.m4","index.en.html.m4");
119
#checkdiff("dselect-beginner.$lang.sgml","dselect-beginner.sgml");