1

We're planning to use Xliff as a common format for our cross-platform application (PHP in the backend, Android on mobile). These Xliff files would not have any "real" source file from which the strings would be extracted, but would rather be hand-crafted as the development goes.

Naturally Xliff needs to be converted / read by the target platform. For Android I imagined it would be the best to convert the source Xliff files to Android String resources files and for PHP I'd have done the same, i.e. the target output would be raw PHP arrays, or use something like Zend_Translate_Xliff.

Now two things are still unresolved:

  1. Are there any existing tools that merge an existing Xliff file into another Xliff file, similar to what msgmerge does for gettext? The rationale here is that if we have X translations and a new string is added to the source language, we don't want to update X target translation file with that new string.

  2. Are there existing converters / XSLT scripts (automatable at best, for CI) that already translate from Xliff to Android XML?

Thanks in advance.

Thomas Keller
  • 5,933
  • 6
  • 48
  • 80
  • I know it is off-topic but: Why Xliff rather than gettext? What does gettext miss that Xliff has? And furthermore why did you choose an XML based format when it will be a mobile app (XML is fat)? I am just curious. Oh, I forgot to mention that I've used the [Swordfish Translation Editor](http://www.maxprograms.com/) and it was OK. However I cannot really compare it to other tools. Also the [Wikipedia article on XLIFF](http://en.wikipedia.org/wiki/XLIFF#Editors) has some more information. – Borislav Sabev May 02 '14 at 11:24
  • 1
    I use Xliff because I find this will be easier convertible to other XML formats, such as Android's resource XML format. Xliff is standardized and allows me to add metadata to translations, like the definition of untranslatable or positional arguments via or general notes via , that help translators translating the strings. – Thomas Keller May 02 '14 at 13:52

1 Answers1

1

There seems to be one project, translate-toolkit - which basically is a set of Python command line utilitites - that does parts of the job.

Merging xliff files works like this:

 pretranslate -t translation.xml source.xml translation-merged.xml

though I haven't tested it how well it actually copes with removed / changed strings. At least existing trans-unit's in translation.xml have to carry an approved="yes" attribute so that these particular units are not marked as "needs-translation" in translation-merged.xml.

Theoretically, translate-toolkit also comes with some PHP support, but I stumbled upon the same problems as mentioned here, i.e. didn't got it working.

Community
  • 1
  • 1
Thomas Keller
  • 5,933
  • 6
  • 48
  • 80