Michael J. Radwin

Tales of a software engineer who keeps kosher and hates the web.

Perl or PHP modules for XLIFF?

Do you know of any good Perl or PHP modules for parsing XLIFF?

I’ve gotten a couple of emails from folks asking about making a French version of my Jewish Calendar Tools website. They’ve volunteered to do all of the translation work themselves if I send them a file to be translated.

Most of the site uses Perl CGI.pm, although parts of it are written in PHP.

The way I see it, I have a few options:

  1. GNU gettext message catalogues. Easy interface with CPAN Locale::gettext module and PHP gettext extension.
  2. Hack something together myself. Send the nice French people an Excel spreadsheet of all of the strings on the site and have them send it back to me. Export to CSV file, then import into whatever format I want (probably BerkleyDB or maybe some custom XML format). Repeat the exercise for a future Hebrew version.
  3. Use XLIFF (XML Localisation Interchange File Format), which is a hip new standard and happens to be what ICU (International Components for Unicode) uses for its message catalogue format.

Option #1 has been around for a long time, but has its warts. Option #2 is what I would’ve done back when I wanted to write everything myself. But I want to learn more about ICU anyways, so I figured XLIFF would be the right place to go.

I expected to find a Locale::XLIFF module on CPAN or a Translation_XLIFF package on PEAR, and was surprised when my searches turned up 0 results.