views:

1179

answers:

2

Has anyone had any experiences developing large Java applications using GNU gettext for internationalization? I find that I really like having the English text in my source code, but I want to make sure that what I'm doing is practical for the relatively large software project I am part of.

If you have experience with this, what are you using to look up the resources in Java? I'm currently trying out Gettext Commons (http://code.google.com/p/gettext-commons/), which seems to be working well so far.

Any alternatives to gettext that keep the original text in your source code? A similar tool that is supported on Windows would be great.

+1  A: 

You could just use plain old Java message resource bundles instead.

Edit: Well, what we really use in our development team is the standard TMX format that lets you specify localization strings in XML files. It is a format commonly used by translation tools. Here is a free one, that lets you edit these files more easily.

Nonetheless I have not mentioned it before because it does not offer any real advantage or functionality over message resource bundles, except for a better encoding handling thanks to XML processing tools (encoding can be a real pain in the neck when handling internationalized literals in languages different to English).

Moreover what we really use is our software is our own framework that parses this XML format and let us change between languages (in HTML pages or Swing frames) without restarting our applications. It is not that hard to develop a simple library that handles literal translations this way, but the downside is that you must implement it.

Fernando Miguélez
I am evaluating the Java built-in I18N functionality as an option, but I wanted to know if gettext was a practical alternative, as it does have a few advantages (ex. handling of plurals, code readability) over resource bundles.
dcstraw
+3  A: 

The JSOM open source OpenStreetMap Java editor project is using the Gettext library to handle all its translations and it is working out very well as people are able to use a variate of translation tools (like KBabel, poedit, launchpad...) to work with the po files so there is no platform constraint there. Also I don't quite see why you think the mentioned setup cannot be used on any platform - you can certainly use gettext in Windows see: here or here

Given how popular gettext is I would certainly recommend it.

mfloryan
Thanks for the answer. I had issues trying to get the Windows version of gettext to work properly, but those issues probably could have been worked out with some more effort. I used Cygwin to run the GNU version on my Windows desktop, and that worked just fine.
dcstraw