XLIFF Parsing Error
Most of the Web applications that I build are multilingual. Since I use the symfony framework often, I rely on the XLIFF standard.
The error
I used to ask my clients to send me a Word document with the translated text. This is the format that they are most comfortable with. An error occurred recently when I copied the text directly from the document to an XLIFF file. For some reason, I could only see the original, English values.
The cause and solution
I would have probably not found the error had I not validated the XML translation file. It gave me a parsing error right in the middle of various strings. They looked fine until I turned on the special characters. Apparently, some special, invisible characters generated a parsing error and broke my application. I sanitized my strings and voilà!
Good practices
Since that incident, I always turn on the special characters in my text editor so that I may pick up any glitches earlier. Also, I no longer ask clients to supply a Word document, but rather a plain text document created with Notepad. To some more technical clients, I even supply the XML with empty <target> tags that they may fill in. That makes less work for me, gives satisfaction to the clients, because they feel empowered, and prevents any parsing errors.


have you tried using OLT XLIFF Editor from java.net? I’m using it with great success on a current project (fr/en). The only thing is that I have to rename messages.xml to messages.xliff if I want the editor to open it.
Thanks for the tip. To me, these files are easy enough to edit in a text editor or from the command-line. Also, I would rather keep messages.xml since I can extract the i18n strings from my templates automatically using symfony’s i18n:extract task.
fair enough, I do directly edit the xml file too.
I just rename the file to send it to customers, and change it back to .xml when they send me the translated file, call me lazy