Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java Internationalization (i18n) Libraries/Frameworks

My organisation is about to embark on the long process of internationalizing (i16g?) its corporate website. The website is a mix of Java EE (JSP/Servlets, no EJB) and static content pushed from the (Documentum) WCM.

While I have experience using the "built-in" mechanism of using ResourceBundle's along with the associated properties files for each language/locale (containing the "KEY=Translated value" approach), where we simply reference the KEY value where we want the translated text to appear.

My director has mentioned that he has used a different approach at a previous organisation whereby they used a 3rd-party library (he does not recall the actual name) which included the actual [english] text in the webpage (to aid developers) which was replaced at run time with the translated content from the config xml file. (anyone know which library this would be?)

I am interested in what other approaches/libraries/frameworks there might be out there to facilitate this.

Thanks

like image 648
Crollster Avatar asked Apr 10 '12 06:04

Crollster


People also ask

What is I18N internationalization?

Internationalization (sometimes shortened to "I18N , meaning "I - eighteen letters -N") is the process of planning and implementing products and services so that they can easily be adapted to specific local languages and cultures, a process called localization .

What is I18N in Java?

Internationalization (i18n) is the process of making your application capable of rendering its text in multiple languages. Localization (l10n) means your application has been coded in such a way that it meets language, cultural, or other requirements of a particular locale.

Which of the following is a common type to Localise in Java?

Locale has three constructors: new Locale(String language) new Locale(String language, String country) new Locale(String language, String country, String variant)


2 Answers

Your boss probably meant gettext, just like @Pawel Dyda mentioned, but cosmopolitan may also be of interest to you.

like image 190
rodion Avatar answered Oct 21 '22 12:10

rodion


My company also maintains a GNU gettext-related library for Java (and very soon with extensions aimed at Scala).

Not only does it support all of the goodness of GNU gettext, it also simplifies output AND input of date/timestamps and currency, include facilities for using "wiki" formatting in translations (so you can output HTML bold on a word, for example), java message formatting, generalized "escape" support (so the output can be auto-escaped for inclusion, say, in HTML), and currency rounding.

It is open-source, and currently on github at https://github.com/awkay/easy-i18n/

like image 42
Tony K. Avatar answered Oct 21 '22 12:10

Tony K.