1

Localizing with ICU recommends keeping localizable data in XLIFF format.

So I used GNU xgettext to extract strings to gettext format files, and then converted them to XLIFF files with po2xliff.

Finally I tried to use XLIFF To ICU ResourceBundle Format Converter to turn them into ICU resource format, before I found it not work. It complains the error:

The XLIFF document is invalid, please check it first: 
Line 2, Column 68
Error: cvc-elt.1: Cannot find the declaration of element 'xliff'.

Almost the same error was reported years ago and is yet to be fixed.

Line 2 of the poor XLIFF file was:

 <xliff xmlns="urn:oasis:names:tc:xliff:document:1.1" version="1.1">

Well, I edited the line in accordiance with example.xlf in Localizing with ICU page (there are lots of typos in example file), retried, and ended up with:

ERROR: java.lang.NullPointerException

So what's the best practice of localizing with ICU4C and XLIFF?

Map X
  • 444
  • 1
  • 4
  • 14

2 Answers2

2

Considering that the XLIFF To ICU ResourceBundle Format Converter does not yet support XLIFF 1.2 (which has been around for many years) I would recommend to stay away from XLIFF and to use po files for localization. There are several localization tools that support po files: in the answers to this question and this one you will find a fairly large number of localization tools that handle po files, and new ones are still being developped (like this one).

Of course not every translator will be able or willing to handle po files, but the chances of getting your software localized are much better via po than by trying to go the XLIFF way.

Jenszcz
  • 547
  • 3
  • 9
1

I can't answer your question on the best practice for localizing with ICU4C and XLIFF, but I have seen the "The XLIFF document is invalid" error when I used the wrong version of the Java JDK while building the ICU resource.

On my system, I see the error when I use jdk1.7.0_67. Everything works fine if I use jdk1.6.0_45. This is with ICU 52.1. You might need to verify that you are using the correct JDK for the version of ICU you are using.

GrandAdmiral
  • 1,348
  • 2
  • 24
  • 52