Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top