docbook2man and translated manpages, Act II

Denis Barbier barbier@linuxfr.org
Fri Dec 20 19:23:00 GMT 2002


[I am not subscribed to this ML, please Cc me]

Hi Tim and others,

Here are your comments about the patch I sent to the Debian Bug Tracking
System, which is also attached:

> The problem with the patch is that it uses $LANG to determine the
> language that the document is written in---unfortunately, it just
> tells us the language that the current user is using, not the
> languange used by the document author.  For that, we must use the
> current value of the 'lang' attribute. (That way a single document
> could contain all of the translations.)

Could you please have a second look on it?
Take any manpage written with docbook, replace
  <refentry>
by
  <refentry lang="xx">
and run docbook2man, it still generates foo.1
Now apply this patch and foo.xx.1 is generated.

Denis
-------------- next part --------------
--- docbook2man-spec.pl.orig	Mon Jul  8 16:00:49 2002
+++ docbook2man-spec.pl	Tue Jul 16 00:25:42 2002
@@ -244,6 +244,14 @@
 	$manpage_misc = '';
 	
 	$list_nestlevel = 0;		# Indent certain nested content.
+
+	# check refentry's language
+	if(defined($_[0]->attribute('LANG')->value)) {
+	  $manpage_lang = $_[0]->attribute('LANG')->value;
+	}
+	else {
+	  $manpage_lang = '';
+	}
 });
 sgml('</REFENTRY>', sub {
 	if(!$newline_last) {
@@ -256,7 +264,11 @@
 });
 
 sgml('</REFMETA>', sub {
-	push_output('file', "$manpage_title.$manpage_sect");
+	if ($manpage_lang) {
+		push_output('file', "$manpage_title.$manpage_lang.$manpage_sect");
+	} else {
+		push_output('file', "$manpage_title.$manpage_sect");
+	}
 
 	output <<_END_BANNER;
 .\\" This manpage has been automatically generated by docbook2man 


More information about the Docbook-tools-discuss mailing list