[Po4a-devel] Question about xml -> pot with po4a - from ADempiere ERP community

Denis Barbier bouzim at gmail.com
Mon Jul 19 09:57:28 UTC 2010


On 2010/7/11 Peanut Blake wrote:
> Dear all,
>
> I am from ADempiere open source ERP. I am using po4a for translation. Thank you very much for your good work!
> Now I meet trouble need your help.
>
> I have one xml file like:
>
>  <row id="103" trl="Y">
>    <value column="Name" original="Minutes">Minutes</value>
>    <value column="UOMSymbol" original="m  " pot-remark="Short form of 'Minutes'. Don't translate @@ID-103@@.">m  @@id-103@@</value>
>  </row>
>
>
> I want to convert to POT file like:
>
> #. Content of: <id-103><Name>
> #, no-wrap
> msgid "Minutes"
> msgstr ""
>
> #. Content of: <id-103><UOMSymbol>
> #. Short form of 'Minutes'. Don't translate @@ID-103@@.
> #, no-wrap
> msgid "m  @@id-103@@"
> msgstr ""

Hi,

When po4a cuts text into translatable strings, it strips comments from
paragraphs and inserts them into POT files.  The XML module is able to
extract XML comments, you can thus write:
  <row id="103" trl="Y">
    <value column="Name" original="Minutes">Minutes</value>
    <value column="UOMSymbol" original="m  "><!-- Short form of
'Minutes'. Don't translate @@ID-103@@. -->m  @@id-103@@</value>
  </row>

But comments will be pushed back into translated XML files.

> I have two questions:
>
> 1. How to put remark in xml to POT?
>   for example, put
> "pot-remark="Short form of 'Minutes'. Don't translate @@ID-103@@.""
>   to
> "#. Short form of 'Minutes'. Don't translate @@ID-103@@."

See above.

> 2. How to put id & column in xml to POT?
>    for example, put
> id="103"  column="Name"
>    to
> #. Content of: <id-103><Name>
>
> Does po4a already provide such functions?

No.
But this looks strange to me, are you sure that this information is
helpful for translators?
If you really want to work that way, you can either
 a) write a dedicated po4a module to handle your DTD as you want
 b) or transform your original XML file into another XML file with
XSLT so that translatable elements contain the desired XML comments,
process this XML file through po4a, and converts back translated XML
files into your original format.

Denis



More information about the Po4a-devel mailing list