[Po4a-devel] po4a beginner questions

Nicolas François nicolas.francois at centraliens.net
Sun Oct 8 12:24:12 UTC 2006


Hi,

On Sun, Oct 08, 2006 at 01:20:04PM +0200, h.eichmann at gmx.de wrote:
> 
> I am currently evaluating po4a and I stumbled into some observations, which 
> someone here can possibly explain. I am running 0.28 on FreeBSD
> 
> 1. Whatever po4a command I try, I always get 2 warnings, example:
> 
> #/usr/local/bin/po4a-gettextize -f sgml -m ./testproj.xml -p ./testproj.pot
> Use of uninitialized value in hash element 
> at /usr/local/lib/perl5/site_perl/5.8.8/Locale/Po4a/Sgml.pm line 668.
> po4a::sgml: Warning: nsgmls is missing or non-functional.  Please make sure 
> that
>             nsgmls is present and does not produce any error (with the
>             -wno-valid option), and report a bug otherwise.  Continuing...

I'm sorry about these warnings. The point is that I can't detect wether
nsgmls detected errors. The return value of nsgmls seems to always be
non-zero nowadays. I should just remove this warning and recommend to
check the validity of the file.

> 2. My test files is a samll docbook test. I have attached it but I do not know 
> if the mailing list supports attachments. It consists of 2 .xml files: 
> testproj.xml which is including test_chapter.xml. If I look at the 
> result .pot File, I see:
> 
> # type: <imageobject></imageobject>
> #: ./testproj.xml:41
> msgid "<imagedata format=\"PNG\" fileref=\"apicture.png\">>"
> msgstr ""
> 
> The first question here is, why this should be translated.

Some people wants to also translate images (e.g. screen shots).
In French, this could be translated in:
msgstr "<imagedata format=\"PNG\" fileref=\"apicture-fr.png\">>"

> The second, more 
> important is, why this ends with a double "larger than". The source code was:
> 
> 		<mediaobject><imageobject><imagedata fileref="apicture.png" format="PNG"/>
> 		</imageobject></mediaobject>

Not in the source you sent:
   <mediaobject>
    <imageobject>
      <imagedata fileref="apicture.png" format="png">>
    </imageobject>
   </mediaobject>


> 3. Looking into the same line I notice, that the line number 
> 
> #: ./testproj.xml:41
> 
> is also wrong. It should be
> 
> #: ./testproj.xml:45 ./test_chapter.xml:6
> 
> as this fragment was from test_chapter.xml

When I run po4a with the file you sent, the line references I get are:

    #: testproj.xml:45 test_chapter.xml:4

(So it needs a little fix, the string is really on line 6).
Can you check again. Maybe it's a difference in the dependencies of po4a
(I'm thinking about nsgmls), which behaves in a different way on FreeBSD.

> 4. If I now translate, lets say
> 
> # type: <author></author>
> #: testproj.xml:14
> msgid "<firstname>J.T.</firstname> <surname>Kirk</surname>"
> msgstr "<firstname>J.T.</firstname> <surname Kirk</surname>"
> 
> (note the missing greater than after surname), po4a-translate creates an 
> invalid xml file. This is off cource not po4a's fault, but the question here 
> is, if po4a could not make an xml validity check on each translated item and 
> print a warning, pointing to the wrongly translated string

I'm keeping it in my TODO.
However, note that doing this with po4a is quite difficult in the sgml
module. (due to sgml conditionnals, po4a is used to deal with invalid
files (tags closed twice, etc.)).
I would prefer to have an option to run an external program to check the
generated files.

Note: You may also want to try the xml and docbook modules for these kind
of files.

> Thanks for reading this

Thanks for your feedback.

-- 
Nekral



More information about the Po4a-devel mailing list