Presentation

The Nuiton I18n library works quite simply. The string to translate are only marked by the I18n._("String to translate") method. It is possible to mark the strings that are not to be translated using the I18n.n_("String not to be translated").

The library must be initialised on the application launch by a method I18n.init() that can take into parameter a locale, a string describing the language,...

The string to translate have to be put in a properties file located in your application's classpath, in a i18n file, and named as : xxx_fr_FR.properties for example.

On initialisation, the library looks in the classpath for all the translation files corresponding to the defined language (in the i18n files of the classpath to be clear) and loads all the translations corresponding to the displayed language. Then, on display, each time a string is asked for, I18n give back the string translated in the corresponding language.

The Maven plugin allows to automatically look for non-translated strings in the source code and create a bundle gathering all the strings and translations of the applications and its dependencies.

To understand how to well use the Nuiton I18n library, it is strongly advised to follow the tutorials, and preferably following the order, as they are of increasing complexity.