Package: sgt-puzzles Version: 8541-1 Severity: wishlist Tags: l10n patch Sgt-puzzles recently added i18n to allow translation of help content into different languages. Currently the package provided by Debian only includes the translation in /usr/share/doc/sgt-puzzles where it is rather hard to find (and has an unusal extension, e.g. ".txt.de.gz" for German, I suggest going with ".de.txt.gz").
Thus currently three areas miss the provided translation:
a) The yelp documentation
b) The provided html files under /usr/share/doc/sgt-puzzles/html
c) The man pages
While for a) I haven't found a solution and b) should be trivial (a
simple copy in debian/rules should be enough) this report addresses
c).
The attached patch currently only creates the man pages, it is missing
the install part (but this again should be easy in debian/rules). And
it only does so for German (see below why).
First it rather crudly adds the generation of man pages in
Makefile.doc. This is only tailored to German atm and needs to be
generalized. (This should not be too difficult). My approach creates
a new directory, but looking at dh_installman, it should be possible
to simply create the proper extension (ll.6 in the current directory
doc/man where ll would be replace by the languuage code, here de).
The second part is a little harder. The attached mkmanpages.de.pl
creates the man pages itself. It works, but not nicely:
a) It requires translators to create a file where the strings are
entangled within code, which is prone to errors.
b) It requires one file per language, which can become a management
nightmare (think of code changes).
c) It does blindly create all man pages, even if they are not
translated at all. This should be avoided, e.g. pages should be
translated only if they contain lets say 60% translated strings
(often 80% is the limit).
c) Can be mitigated by editing the file to only create those pages
where manually verification has shown that enough content is present.
It would be nice if you could include this "bandaid" for German while
working on a more general solution. Something like
dh_installman --language=de doc/de/man/*.6
should be sufficient in debian/rules.
Depending on available ressources, I will look at the more pressing
problem of yelp integration next, but if you happen to know an expert
I'd gladly delegate that.
P.S. For the manpage of netgame, I notice that "The latter clause
means that there are no closed paths within the network. Could this be
clearer? \"No closed
paths\"?" is missing from the man page. Is this intentional?
-- System Information:
Debian Release: 5.0.1
APT prefers stable
APT policy: (500, 'stable')
Architecture: powerpc (ppc)
Kernel: Linux 2.6.24.3-grsec
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages sgt-puzzles depends on:
ii libatk1.0-0 1.22.0-1 The ATK accessibility toolkit
ii libc6 2.7-18 GNU C Library: Shared libraries
ii libcairo2 1.6.4-7 The Cairo 2D vector graphics libra
ii libglib2.0-0 2.16.6-1+lenny1 The GLib library of C routines
ii libgtk2.0-0 2.12.12-1~lenny1 The GTK+ graphical user interface
ii libpango1.0-0 1.20.5-3 Layout and rendering of internatio
Versions of packages sgt-puzzles recommends:
ii chimera2 [www-browser] 2.0a19-5 Web browser for X
ii iceweasel [www-browser] 3.0.6-1 lightweight web browser based on M
ii konqueror [www-browser] 4:3.5.9.dfsg.1-6 KDE's advanced file manager, web b
ii links [www-browser] 2.1pre37-1.1 Web browser running in text mode
ii lynx-cur [www-browser] 2.8.7dev9-2.1 Text-mode WWW Browser with NLS sup
ii w3m [www-browser] 0.5.2-2+b1 WWW browsable pager with excellent
ii yelp 2.22.1-8+b1 Help browser for GNOME 2
sgt-puzzles suggests no packages.
-- no debconf information
--
Dr. Helge Kreutzmann [email protected]
Dipl.-Phys. http://www.helgefjell.de/debian.php
64bit GNU powered gpg signed mail preferred
Help keep free software "libre": http://www.ffii.de/
--- /scr/build/debian/sgt-puzzles/puzzles-r8541/Makefile.doc 2009-05-10 15:29:49.000000000 +0200 +++ Makefile.doc 2009-05-10 08:13:46.000000000 +0200 @@ -11,11 +11,14 @@ halibut --html puzzles.but chm.but man: doc/man-stamp -doc/man-stamp: puzzles.but +doc/man-stamp: puzzles.but doc/puzzles.but.de mkdir -p doc rm -rf doc/man mkdir doc/man perl mkmanpages.pl + rm -rf doc/de/man + mkdir -p doc/de/man + perl mkmanpages.de.pl touch $@ html: doc/html-stamp
#!/usr/bin/perl -w
# Generate manual pages for sgt-puzzles by running extracts of doc/puzzles.but.de
# through halibut.
use strict;
use File::Temp;
use IO::File;
# Header information
my $package = "sgt\\-puzzles";
my $date;
my $section = "Games";
my $section_no = "6";
# Name of command corresponding to each game-specific chapter name
my %commands = (blackbox => 'blackboxgame',
bridges => 'bridges',
cube => 'cube',
dominosa => 'dominosa',
fifteen => 'fifteen',
filling => 'filling',
flip => 'flipgame',
galaxies => 'galaxies',
guess => 'guess',
inertia => 'inertia',
lightup => 'lightup',
loopy => 'loopy',
map => 'map',
mines => 'mines',
net => 'netgame',
netslide => 'netslide',
pattern => 'pattern',
pegs => 'pegs',
rectangles => 'rect',
samegame => 'samegame',
sixteen => 'sixteen',
slant => 'slant',
solo => 'solo',
tents => 'tents',
twiddle => 'twiddle',
unequal => 'unequal',
untangle => 'untangle');
my %short_descs = (blackboxgame => 'Ratespiel',
bridges => 'topological deduction game',
cube => 'Kachelmanipulations-Puzzlespiel',
dominosa => 'Domino-Puzzlespiel',
fifteen => 'Kachelmanipulations-Puzzlespiel',
filling => 'Puzzlespiel',
flipgame => 'Kachelmanipulations-Puzzlespiel',
galaxies => 'Puzzlespiel',
guess => 'Ratespiel basierend auf Mastermind',
inertia => 'Puzzlespiel',
lightup => 'Puzzlespiel',
loopy => 'topological deduction game',
map => 'Kartenfärbespiel',
mines => 'Spiel basierend auf Minesweeper',
netgame => 'Kachelmanipulations-Puzzlespiel basierend auf FreeNet',
netslide => 'Kachelmanipulations-Puzzlespiel',
pattern => 'Nonogram-Puzzlespiel',
pegs => 'Peg-Solitaire-Puzzlespiel',
rect => 'Puzzlespiel basierend auf »Divide by Squares«',
samegame => 'Puzzlespiel',
sixteen => 'Kachelmanipulations-Puzzlespiel',
slant => 'topological deduction game',
solo => 'Puzzlespiel basierend auf Sudoku',
tents => 'Puzzlespiel',
twiddle => 'Kachelmanipulations-Puzzlespiel',
unequal => 'Puzzlespiel basierend auf Futoshiki',
untangle => 'Puzzlespiel basierend auf Planarity');
my @MONTHS = qw(Januar Februar März April Mai Juni
July August September Oktober November Dezember);
# Chapter name, initialised to dummy value to capture header
my $name = '__HEADER__';
# Contents of each chapter/appendix
my %contents;
# Gather chapters from the original documentation
my $source = new IO::File;
$source->open("<doc/puzzles.but.de") or die "doc/puzzles.but.de: $!";
while (<$source>) {
# Look for chapter/appendix heading
if (/^\\[AC]{([^}]+)}\s*/) {
$name = $1;
}
# Look for version ID with date
if (/^\\versionid \$Id: [^ ]+ \d+ (\d{4})-(\d{2})-\d{2} /) {
$date = "${MONTHS[$2-1]} $1";
}
$contents{$name} .= $_;
}
close $source;
# Remove all normal text from the header
$contents{__HEADER__} =~ s/^(?!\\(?:cfg|define|title){).*$//gm;
# Remove introduction from "common features" chapter
$contents{common} =~ s/^.*?(?=\\H{)//s;
for my $chapter (keys %commands) {
my $command = $commands{$chapter};
print "Generating $command.6\n";
my $contents =
"\\cfg{man-mindepth}{1}\n" # don't show original chapter headings
. "\\cfg{man-identity}{".uc($command)."}{$section_no}{$date}{$command ($package)}{$section}\n\n"
. $contents{__HEADER__}
. "\\C{man-$command} $command\n\n" # dummy chapter
. "\\H{man-$command-name} NAME\n\n"
. "\\c{$command} \\- $short_descs{$command}\n\n"
. "\\H{man-$command-synopsis} SYNOPSIS\n\n"
. "\\cw{$command} [\\cw{--generate }\\e{n}]\n"
. "[\\cw{--print }\\e{w}\\cw{x}\\e{h} [\\cw{--with-solutions}]\n"
. "[\\cw{--scale }\\e{n}] [\\cw{--colour}]]\n"
. "[\\e{Spiele-Parameter}|\\e{Spiele-ID}|\\e{Zufallsstartwert}]\n\n"
. "\\cw{$command --version}\n\n"
. "\\H{man-$command-desc} BESCHREIBUNG\n\n"
. $contents{$chapter}
. $contents{common}
. "\\H{man-$command-see-also} SIEHE AUCH\n\n"
. "Komplette Dokumentation in /usr/share/doc/$package/puzzles.txt.de.gz.\n";
# Kluge cross-references
sub replace_ref {
my ($above, $target, $below) = @_;
# If the target is an earlier or later section in the current page, say
# it's above or below.
if ($above =~ m/\\(?:[CHA]|S\d*){$target}/) {
'oben';
} elsif ($below =~ m/\\(?:[CHA]|S\d*){$target}/) {
'unten';
}
# Else if the target is a bibliographic entry, include the entry directly.
elsif ($below =~ m/\\B{$target}\s*(.*?)\s*(?:\\(?:[BCHA]|S\d*|$))/s) {
"($1)";
}
# Else if it appears to refer to another game, convert to a customary
# cross-manual-page reference.
elsif ($target =~ /(\w+)/ && exists $commands{$1}) {
"\\e{$commands{$1}}($section_no)";
}
# Otherwise (and this shouldn't happen), show the reference target.
else {
print STDERR "Failed to resolve reference to $target\n";
$target;
}
}
$contents =~ s/(?:\bin\s+)?\\[kK]{([^}]+)}/replace_ref($`, $1, $')/eg;
# Run through halibut, working around bug #320333 (fixed for etch,
# but this source is meant to build under sarge too).
# halibut does not default to using stdin or stdout, and
# /dev/std{in,out} apparently don't exist on some systems, so we
# can't reliably do this with a pipeline.
my ($temp_but, $temp_but_name) = mkstemp "/tmp/sgt-puzzles-but-XXXXXX"
or die "$!";
print $temp_but $contents or die "$!";
close $temp_but;
my ($temp_man, $temp_man_name) = mkstemp "/tmp/sgt-puzzles-man-XXXXXX"
or die "$!";
close $temp_man;
system "halibut --man=$temp_man_name $temp_but_name";
system "grep -v '^\\.UC' <$temp_man_name >doc/de/man/$command.6";
unlink $temp_but_name;
unlink $temp_man_name;
-s "doc/man/$command.6" or die "halibut produced an empty $command.6";
}
exit;
signature.asc
Description: Digital signature

