Localizing text from XML files

You should use a localized XML format like XLIFF or TMX , there is a tool to convert XLIFF to .po.

If you cannot change the source XML you have a few options but it really depends how your outputting this XML info:

  1. Parse the XML ( for label) and create a .po with gettext output for these strings (then possibly merge the .po files).
  2. Duplicate the XML and insert the _() gettext right into the XML, then parse it on output.

Also have a look at this tool, and there are some command line python tools that can convert xml–>po I think, http://itstool.org/

Leave a Comment