[Po4a-devel] po4a beginner questions

Heiner h.eichmann at gmx.de
Sun Oct 8 15:07:11 UTC 2006


On Sunday 08 October 2006 14:24, Nicolas François wrote:
> > 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\">>"

Good point.

> > 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>

Definitely not. If I download 
http://lists.alioth.debian.org/pipermail/po4a-devel/attachments/20061008/20d21c4d/test_chapter.bin

I get:

7of9# hd test_chapter.bin

...

00000110  6a 65 63 74 3e 3c 69 6d  61 67 65 64 61 74 61 20  |ject><imagedata |
00000120  66 69 6c 65 72 65 66 3d  22 61 70 69 63 74 75 72  |fileref="apictur|
00000130  65 2e 70 6e 67 22 20 66  6f 72 6d 61 74 3d 22 50  |e.png" format="P|
00000140  4e 47 22 2f 3e 0a 09 09  3c 2f 69 6d 61 67 65 6f  |NG"/>...</imageo|
00000150  62 6a 65 63 74 3e 3c 2f  6d 65 64 69 61 6f 62 6a  |bject></mediaobj|

Its definetely /> at the end of the imagedata tag. Otherwise it would be 
invalid xml. If I do the same with the generated pot file:

00000920  31 0a 6d 73 67 69 64 20  22 3c 69 6d 61 67 65 64  |1.msgid "<imaged|
00000930  61 74 61 20 66 6f 72 6d  61 74 3d 5c 22 50 4e 47  |ata format=\"PNG|
00000940  5c 22 20 66 69 6c 65 72  65 66 3d 5c 22 61 70 69  |\" fileref=\"api|
00000950  63 74 75 72 65 2e 70 6e  67 5c 22 3e 3e 22 0a 6d  |cture.png\">>".m|
00000960  73 67 73 74 72 20 22 22  0a 0a 23 20 74 79 70 65  |sgstr ""..# type|
00000970  3a 20 3c 2f 6d 65 64 69  61 6f 62 6a 65 63 74 3e  |: </mediaobject>|

There was definiately an /> converted into a >> !


> > 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.

Not sure what to check here. I did run

/usr/local/bin/po4a-gettextize -f sgml -m ./testproj.xml -p ./testproj.pot

again but with the same result. Most entries from test_chapter.xml were listed 
as 

#: ./testproj.xml:41

Some from the end of test_chapter.xml as

#: ./testproj.xml:45 ./test_chapter.xml:11

to

#: ./testproj.xml:45 ./test_chapter.xml:30

I have appended my .pot file as reference. It might help, that I am using 
nsgmls from jade:

7of9# pkg_info -W /usr/local/bin/nsgmls
/usr/local/bin/nsgmls was installed by package jade-1.2.1_9

My po4a installation is not from the FreeBSD ports (it has not been updated 
since 0.23) but from a patched port (where I bumped the version number).


> > 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.

Whatever you plan to do here, it should work on the .po file entry level! In 
other words it should say: "your translation of .... 
in ./testproj.xml:45 ./test_chapter.xml:30 is wrong, as it breaks the xml 
syntax or semantic rules". It does not help if it states during 
po4a-translate, that the result xml files has an unterminated <whatever> tag. 
Finding the wrong translation in the .po will probably last forever!


Thanks

Heiner
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testproj.pot
Type: application/x-gettext
Size: 3573 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/po4a-devel/attachments/20061008/f3daf460/testproj.bin


More information about the Po4a-devel mailing list