[Po4a-devel] Putting multiple translations in an XML document

Francois Gouget fgouget at free.fr
Wed Nov 18 14:50:13 UTC 2009


So I'm still with my XML file I'd like to translate and I have another 
issue with it, which is quite independent.

The thing is I'd like to have all the translations in one file so I can 
then ship just this one file and the application using the file would 
then pick the right locale.

So starting from my test file:

<?xml version="1.0" encoding="UTF-8" ?>
<root>
  <global>
    <name>To be translated</name>
    <other>foo</other>
    <yetother>bar</yetother>
  </global>
</root>

I would like to get:

<?xml version="1.0" encoding="UTF-8" ?>
<root>
  <global>
    <name>To be translated</name>
    <name lang="fr">A traduire</name>
    <name lang="de">de--To be translated--de</name>
    <other>foo</other>
    <yetother>bar</yetother>
  </global>
</root>


That does not seem to be doable with the standard XML module or any 
other. I guess that means I should code my own. I'm a bit worried the 
infrastructure is not geared towards that kind of use though. For 
instance po4a-translate does not expect to be given multiple po files. 
Is there some code that does something similar and that I could use as a 
model?

The only other similar case I can think of is the .desktop files, but as 
far as I can tell they are not supported by po4a and are not XML either.

This new module could probably be made pretty general: take a tag and 
duplicate it, adding a lang attribute with the proper value. Ideally one 
would use a copy of the file with no translation at all as the source to 
avoid confusion. I don't know if anyone else would be interested in such 
a module though.

-- 
Francois Gouget <fgouget at free.fr>              http://fgouget.free.fr/
            "Lotto: A tax on people who are bad at math." -- unknown
          "Windows: Microsoft's tax on computer illiterates." -- WE7U



More information about the Po4a-devel mailing list