[Po4a-devel]LaTeX module test on freeduc documentation

Nicolas François nicolas.francois@centraliens.net
Mon, 14 Mar 2005 22:42:24 +0100


--ew6BAiZeqk4r7MaW
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Hello,

Here is the patch to the freeduc-doc cvs that permits to handle the TeX
documentation.

It is quite small.

The modification in xfig.tex is needed because a an \item is followed by:
{\small ...}
This is probably perfectly correct, but the parser take it for an
argument, whereas I specified the \item command as only having an optional
argument.
The patch specifies temporarily that the \item command can have any number
of mandatory arguments which are all translated.
This could probably be safely specified with the other commands, but I
wanted to play and test if the command definitions could be used to
define temporary behavior.

After applying this patch, po4a deals like a charm with this LaTeX
documentation. (with the exception of the % in the xml command)

Regarding the xml command, I will try to add the ability to specify
commands with the same behavior as the verbatim environment (no rewrap,
and no comments). At this time, a workaround could be to specify the new
HlxTopPanel command in a separate file, excluded from the po4a inclusion
(or excluding the macro.tex file, and translating it manualy).


The translation, once the PO file is translated is obtained by:
TEXINPUTS=/usr/share/texmf/tex/latex/base \
PERLLIB=/home/fzt/sources/po4a/cvs/lib \
/home/fzt/sources/po4a/cvs/po4a-translate -f latex -m book.tex \
-p freeduc.pot -o exclude_include=content-fr:application-fr \
-M ISO-8859-1 \
-l book-po4a.tex -L ISO-8859-1

The -l switch specifies where the translated document is output,
and the -L switch, its encoding.
Note: A patch for the Transtractor is available on the CVS

an additional -k 0 switch can be added to test the translation when only a
small part of the PO is translated.


I had a look at the PO file, it seems quite nice to me (strings are not
too much split, not too much grouped).
You will find itemize paragraphs very ugly. I have locally a patch that
permits to translate separately each items. It also permits to split cells
in tabular environments or commands like authors where \\ permits to
separate different fields.


A last concern:
It seems the freeduc-doc project has multiple master languages.
This may be more difficult to handle than translation from a single
language. The po4a command provided previously permits to translate
the French document into another language, and generates a single
book-<lang>.tex document. In order to translate granules (the LaTeX
chapters found in different files) from different languages, it could be
better to translate each granule separately. This could be done by adding
this line in every granules:
\input{po4a-definitions}
and having all the po4a definitions ("% po4a: " line) in this
po4a-definitions.tex file.
A po4a config file could then be used to ease translator's life (less
commands, more reuse of translations)

Best Regards,
-- 
Nekral

--ew6BAiZeqk4r7MaW
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="freeduc.diff"

Index: macro.tex
===================================================================
RCS file: /cvs/freeduc-doc/freeduc-doc/macro.tex,v
retrieving revision 1.6
diff -a -u -r1.6 macro.tex
--- macro.tex	16 Feb 2005 09:19:55 -0000	1.6
+++ macro.tex	14 Mar 2005 20:44:12 -0000
@@ -1,6 +1,36 @@
 % Copyright 2002-2003 OFSET
 % Licensed under the terms of the FDL
 
+% declarations for po4a:
+% po4a: environment ifhtml push_environment
+% po4a: environment iftex  push_environment
+% po4a: command *EmptyP 0,-1,,-1
+% po4a: command *sloppy 0,0,,
+% po4a: command *htmltitle 0,1,,1
+% po4a: command *htmladdress 0,1,,1
+% po4a: command *xlink 0,2,,1 2
+% po4a: command *freeducIcon 0,1,,
+% po4a: command *freeducChapter 0,1,,1
+% po4a: command *freeducSection 0,1,,1
+% po4a: command *freeducSubsection 0,1,,1
+% po4a: command *freeducSubsubsection 0,1,,1
+% po4a: command *freeducNote 0,1,,1
+% po4a: command *freeducIndex 0,4,,1 2 3 4
+% po4a: command *freeducLink 0,1,,1
+% po4a: command *freeducDocLink 0,2,,1 2
+% po4a: command *freeducFigureSize 0,3,,1
+% po4a: command *freeducFigureSizeGif 0,3,,1
+% freeducMenu maybe included in a sentence, and should be translated withi
+% this sentence. Do not separate it (no *)
+% po4a: command freeducMenu 0,1,,1
+% po4a: command *freeducParagraph 0,1,,1
+% po4a: command *freeducFigure 0,2,,1
+% po4a: command *freeducImage 0,1,,
+% po4a: command *freeducImageSize 0,2,,
+% po4a: command *freeducTextLink 0,2,,1 2
+% po4a: command *htmlprintindex 0,0,,
+%TBC: not always the same number of arguments?
+% po4a: command *freeducAppendix 0,-1,,-1
 
 % Define some macro
 \newcommand{\freeducVersion}{1.4}
@@ -11,7 +41,7 @@
 % First redefine some HyperLatex command
 \begin{ifhtml}
 \newcommand{\HlxTopPanel}{\EmptyP{\HlxSeqPrevUrl\HlxUpUrl\HlxSeqNextUrl}{%
-  \xml*{table width="100%" cellpadding=0 cellspacing=2}\xml{tr}
+  \xml*{table width="100\%" cellpadding=0 cellspacing=2}\xml{tr}
   \xml*{td bgcolor="##99ccff"}%
   \EmptyP{\HlxSeqNextUrl}
   {\xlink{\HlxCallEval{\HlxImage}{\HlxPure{\HlxSeqNextTitle}}{next.png}}%
@@ -30,7 +60,7 @@
     {\HlxSeqPrevUrl}}%
   {\htmlimage[alt=""]{\HlxIcons{}blank.png}}%
   \xml*{/td}%
-  \xml*{td align="center" bgcolor="##99ccff" width="100%"}%
+  \xml*{td align="center" bgcolor="##99ccff" width="100\%"}%
     \textbf{\HlxThisTitle}%
   \xml*{/td}%
   \HlxPanelFields
Index: fr/applications/xfig.tex
===================================================================
RCS file: /cvs/freeduc-doc/freeduc-doc/fr/applications/xfig.tex,v
retrieving revision 1.1
diff -a -u -r1.1 xfig.tex
--- fr/applications/xfig.tex	2 Dec 2004 17:51:38 -0000	1.1
+++ fr/applications/xfig.tex	14 Mar 2005 20:44:37 -0000
@@ -277,6 +277,9 @@
 
 Pour aller plus loin, on pourra consulter les sites suivants~:
 
+% change the item command to avoid a problem
+% po4a: command *item 0,-1,,-1
+
 \begin{itemize}
 \item \freeducLink{http://www.xfig.org/userman/}
 \item \freeducLink{http://duke.usask.ca/\~{}macphed/soft/fig/}
@@ -287,3 +290,5 @@
 
 
 
+% restore item behavior
+% po4a: command *item 1,0,1,

--ew6BAiZeqk4r7MaW--