--- Begin Message ---
Package: help2man
Version: 1.29-1
Severity: normal
Tags: patch
Hi,
here is a patch against help2man to generate translated man pages.
There is a minor glitch: when determining SYNOPSIS, the 'or:' string
can no more be checked, so I assumed that any line beginning with
a space is a continuation line.
If this is unsafe, I guess that gettext("or:") can be used.
Denis
--- help2man-1.29/debian/control 2003-03-06 14:56:17.000000000 +0100
+++ help2man-1.29/debian/control 2003-03-06 16:45:39.000000000 +0100
@@ -3,11 +3,12 @@
Priority: optional
Maintainer: Brendan O'Dea <[EMAIL PROTECTED]>
Standards-Version: 3.5.1
-Build-Depends: perl (>= 5.6.0-18), debhelper (>= 3.0.5)
+Build-Depends: perl (>= 5.6.0-18), gettext, debhelper (>= 3.0.5)
Package: help2man
Architecture: all
Depends: ${perl:Depends}
+Recommends: liblocale-gettext-perl
Description: Automatic manpage generator
Program to create simple man pages from the --help and
--version output of other programs.
--- help2man-1.29/help2man.PL 2002-09-06 18:14:19.000000000 +0200
+++ help2man-1.29/help2man.PL 2003-03-06 16:33:44.000000000 +0100
@@ -83,12 +83,21 @@
use strict;
use Getopt::Long;
use Text::Tabs qw(expand);
-use POSIX qw(strftime setlocale LC_TIME);
-
!NO!SUBS!
# Interpolate program name and version:
print OUT <<"!GROK!THIS!";
+BEGIN {
+ eval 'use Locale::gettext';
+ if (\$@)
+ {
+ eval 'sub gettext { return shift }';
+ eval 'sub textdomain { 1 }';
+ }
+ textdomain('$program');
+}
+use POSIX qw(strftime setlocale LC_TIME LC_CTYPE LC_MESSAGES);
+
my \$this_program = '$program';
my \$this_version = '$version';
!GROK!THIS!
@@ -114,6 +123,7 @@
-s, --section=SECTION section number for manual page (1, 6, 8)
-m, --manual=TEXT name of manual (User Commands, ...)
-S, --source=TEXT source of program (FSF, Debian, ...)
+ -l, --locale=STRING select another locale
-i, --include=FILE include material from `FILE'
-I, --opt-include=FILE include material from `FILE' if it exists
-o, --output=FILE send output to `FILE'
@@ -134,6 +144,7 @@
my $section = 1;
my $manual = '';
my $source = '';
+my $locale = 'C';
my $help_option = '--help';
my $version_option = '--version';
my ($opt_name, @opt_include, $opt_output, $opt_info, $opt_no_info);
@@ -143,6 +154,7 @@
's|section=s' => \$section,
'm|manual=s' => \$manual,
'S|source=s' => \$source,
+ 'l|locale=s' => \$locale,
'i|include=s' => sub { push @opt_include, [ pop, 1 ] },
'I|opt-include=s' => sub { push @opt_include, [ pop, 0 ] },
'o|output=s' => \$opt_output,
@@ -248,8 +260,8 @@
for (keys %$hash) { $hash->{$_} =~ s/\n+$/\n/ }
}
-# Turn off localisation of executable's ouput.
[EMAIL PROTECTED](LANGUAGE LANG LC_ALL)} = ('C') x 3;
+# Turn on localisation of executable's ouput.
[EMAIL PROTECTED](LANGUAGE LANG LC_CTYPE LC_MESSAGES)} = ($locale) x 4;
# Turn off localisation of date (for strftime).
setlocale LC_TIME, 'C';
@@ -333,14 +345,14 @@
}
# Extract usage clause(s) [if any] for SYNOPSIS.
-if ($help_text =~ s/^Usage:( +(\S+))(.*)((?:\n(?: {6}\1| *or: +\S).*)*)//m)
+if ($help_text =~ s/^Usage:( +(\S+))(.*)((?:\n(?: {6}\1| +[^:]*: +\S).*)*)//m)
{
my @syn = $2 . $3;
if ($_ = $4)
{
s/^\n//;
- for (split /\n/) { s/^ *(or: +)?//; push @syn, $_ }
+ for (split /\n/) { s/^ +([^:]*: +)?//; push @syn, $_ }
}
my $synopsis = '';
@@ -560,19 +572,7 @@
$sect = 'SEE ALSO';
$include{$sect} ||= '';
$include{$sect} .= ".PP\n" if $include{$sect};
- $include{$sect} .= <<EOT;
-The full documentation for
-.B $program
-is maintained as a Texinfo manual. If the
-.B info
-and
-.B $program
-programs are properly installed at your site, the command
-.IP
-.B info $info_page
-.PP
-should give you access to the complete manual.
-EOT
+ $include{$sect} .= sprintf (gettext("The full documentation for\n.B %s\nis
maintained as a Texinfo manual. If the\n.B info\nand\n.B %s\nprograms are
properly installed at your site, the command\n.IP\n.B info %s\n.PP\nshould give
you access to the complete manual."), $program, $program, $info_page)."\n";
}
# Output header.
@@ -586,13 +586,25 @@
my @post = ('AUTHOR', 'REPORTING BUGS', 'COPYRIGHT', 'SEE ALSO');
my $filter = join '|', @pre, @post;
+my @l10nfields = (
+ gettext("NAME"),
+ gettext("SYNOPSIS"),
+ gettext("DESCRIPTION"),
+ gettext("OPTIONS"),
+ gettext("EXAMPLES"),
+ gettext("AUTHOR"),
+ gettext("REPORTING BUGS"),
+ gettext("COPYRIGHT"),
+ gettext("SEE ALSO"),
+);
+
# Output content.
for (@pre, (grep ! /^($filter)$/o, @include), @post)
{
if ($include{$_})
{
my $quote = /\W/ ? '"' : '';
- print ".SH $quote$_$quote\n";
+ print ".SH $quote".gettext($_)."$quote\n";
for ($include{$_})
{
--- help2man-1.29/Makefile.in 2002-09-06 18:14:19.000000000 +0200
+++ help2man-1.29/Makefile.in 2003-03-06 16:45:52.000000000 +0100
@@ -44,6 +44,8 @@
$(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) $(target).info; \
fi
+ $(MAKE) -C po install
+
uninstall:
rm -f $(DESTDIR)$(bindir)/$(target) \
$(DESTDIR)$(man1dir)/$(target)$(manext) \
@@ -55,6 +57,8 @@
$(target).info; \
fi
+ $(MAKE) -C po uninstall
+
check: $(target)$(manext)
--- help2man-1.29/po/fr.po 1970-01-01 01:00:00.000000000 +0100
+++ help2man-1.29/po/fr.po 2003-03-06 16:16:34.000000000 +0100
@@ -0,0 +1,80 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <[EMAIL PROTECTED]>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: help2man VERSION\n"
+"POT-Creation-Date: 2003-03-06 16:11+0100\n"
+"PO-Revision-Date: 2003-03-06 16:16+0100\n"
+"Last-Translator: Denis Barbier <[EMAIL PROTECTED]>\n"
+"Language-Team: French <[EMAIL PROTECTED]>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=ISO-8859-15\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../help2man:501
+#, c-format
+msgid ""
+"The full documentation for\n"
+".B %s\n"
+"is maintained as a Texinfo manual. If the\n"
+".B info\n"
+"and\n"
+".B %s\n"
+"programs are properly installed at your site, the command\n"
+".IP\n"
+".B info %s\n"
+".PP\n"
+"should give you access to the complete manual."
+msgstr ""
+"La documentation complète pour\n"
+".B %s\n"
+"est mise à jour dans un manuel Texinfo (en anglais).\n"
+"Si les programmes\n"
+".B info\n"
+"et\n"
+".B %s\n"
+"sont correctement installés sur votre système, la commande\n"
+".IP\n"
+".B info %s\n"
+".PP\n"
+"devrait vous donner accès au manuel complet (en anglais)."
+
+#: ../help2man:516
+msgid "NAME"
+msgstr "NOM"
+
+#: ../help2man:517
+msgid "SYNOPSIS"
+msgstr "SYNOPSIS"
+
+#: ../help2man:518
+msgid "DESCRIPTION"
+msgstr "DESCRIPTION"
+
+#: ../help2man:519
+msgid "OPTIONS"
+msgstr "OPTIONS"
+
+#: ../help2man:520
+msgid "EXAMPLES"
+msgstr "EXEMPLES"
+
+#: ../help2man:521
+msgid "AUTHOR"
+msgstr "AUTHOR"
+
+#: ../help2man:522
+msgid "REPORTING BUGS"
+msgstr "SIGNALER DES BOGUES"
+
+#: ../help2man:523
+msgid "COPYRIGHT"
+msgstr "COPYRIGHT"
+
+#: ../help2man:524
+msgid "SEE ALSO"
+msgstr "VOIR AUSSI"
--- help2man-1.29/po/Makefile 1970-01-01 01:00:00.000000000 +0100
+++ help2man-1.29/po/Makefile 2003-03-06 16:40:31.000000000 +0100
@@ -0,0 +1,36 @@
+
+target = help2man
+
+prefix = /usr
+
+POTFILE = $(target).pot
+POFILES = $(wildcard *.po)
+MOFILES = $(POFILES:.po=.mo)
+
+all: $(POTFILE) $(MOFILES)
+
+install: all
+ for file in $(MOFILES); do \
+ lang=`echo $$file | sed 's/\.mo//'`; \
+ install -d
$(DESTDIR)$(prefix)/share/locale/$$lang/LC_MESSAGES/; \
+ install -m 0644 $$file
$(DESTDIR)$(prefix)/share/locale/$$lang/LC_MESSAGES/$(target).mo; \
+ done
+
+uninstall:
+ -rm -f $(DESTDIR)$(prefix)/share/locale/*/LC_MESSAGES/$(target).mo
+
+$(POTFILE): ../$(target)
+ xgettext -o $@ -Lc $?
+
+clean:
+ rm -f $(POTFILE) $(MOFILES) messages messages.mo
+
+%.mo: %.po
+ msgfmt -o $@ $<
+
+check:
+ @for file in $(POFILES); do \
+ lang=`echo $$file | sed 's/\.po//'`; \
+ printf "$$lang: "; \
+ msgfmt -o /dev/null -c -v --statistics $$lang.po;\
+ done
--- End Message ---