[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Making doc translators' life easier

Here's a little hack I use to check which of the docs changed since I
translated them and what has changed.

 - copy the script to "documentation" directory
 - modify it:
	change the "$lang" variable to your language

	remove the "checkdiff" function invocations for the documents you
		don't have translated and/or add the ones I haven't
		translated :-)
 - add <!-- original version: N.nn --> to the translated files (N.nn is the
   revision of the english version when you translated the file)

 - run ./docheck to see which files changed
 - run ./docheck -d | less to see what has changed in what files

have fun :-}


+--------------------------------+ The reason we come up with new versions
|Marcin Owsiany                  | is not to fix bugs. It's the stupidest
|porridge@pandora.info.bielsko.pl| reason to buy a new version
+--------------------------------+ I ever heard.            - Bill Gates
#!/usr/bin/perl -w

# Set this to your language code
$lang = "pl";

sub checkdiff
	($plfname, $enfname) = (@_);
	($plrev, $enrev) = getrev($plfname, $enfname);
	if ( "$plrev" ne "$enrev" ) {
		if ( defined($ARGV[0]) and ("$ARGV[0]" eq "-d") ) {
			system("cvs diff -u -r $plrev -r $enrev $enfname");
		} else {
			print "$enfname : $plrev -> $enrev\n";

sub getrev
	($plfname, $enfname) = (@_);

	open FILE, $plfname or die "$plfname: $!";
	while (<FILE>) {
		if (/<!--\s*original version\D*([\d\.]+)\s*-->/) {
			$plrev = $1;
	open FILE, $enfname or die "$enfname: $!";
	while (<FILE>) {
		if (/\$Id: [^\s]+ ([\d\.]+) .* Exp \$/) {
			$enrev = $1;
	close FILE;
	return ($plrev, $enrev);

@subdocs = ("administrivia", "appendix", "dbootstrap", "hardware", "inst-methods", "partitioning", "post-install", "preparing", "rescue-boot", "tech-info", "welcome");

foreach $doc (@subdocs) {
	$plfname = "$lang/" . "$doc" . ".sgml";
	$enfname = "en/" . "$doc" . ".sgml";
	checkdiff($plfname, $enfname);
checkdiff("install.$lang.sgml", "install.sgml");

Reply to: