InfoQ Homepage News Simplified i18n with new Cintoo Messages 1.0

Simplified i18n with new Cintoo Messages 1.0

Cintoo Messages is an i18n framework that was developed over the course of several large internationalization projects where existing Java solutions were not sufficient.  Messages supports locales for threads and different bundles for different Java packages.  Bundle mapping configuration is done outside of client classes resulting in simplified code. Cintoo Messages 1.0 has just been released under Apache License.

InfoQ spoke to messages creator Stephan Schmidt to find out more about the new framework:
There are several problems with the current Java way. There is no support for thread local locales (useful for web applications, easy to get the locale everywhere). Usually i18n code in Java is very noisy, with lots of i18n code, it's very difficult to read and understand business code.

Usually an application has several bundle files. But then when doing i18n the developer has to think about which bundle to use for each class. With Messages he just has to supply "this" to Messages and the framework will find the correct bundle. As the configuration of the bundle mappings is done outside of the application code, the developer can change the mapping afterwards.
The end result is replacing the following typical Java 5 internationalization code:
public Account create(String name) {
    Account account = new Account( name );
    Locale locale = new Locale("en", "");
    ResourceBundle bundle =  ResourceBundle.getBundle("accounting", locale);
    MessageFormat formatter = new MessageFormat("");
    formatter.applyPattern( messages.getString("ACCOUNT_CREATED") );
    show( formatter.format( account ) );
    return account;

With this simpler Cintoo Messages code (after associating a bundle with the com.accounting package):
public Account create(String name) {
    Account account = new Account( name );
    show( $(this, “ACCOUNT_CREATED”, account) );
    return account;

According to Stephan, "indirect competiors are IDE plugins which do i18n automatically (with all the problems) and commercial vendors who sell i18n applications which do the same as the plugins, finding "hello world" strings and replacing them with i18n code. Both solve the i18n problem in a different way than cintoo Messages which focuses on developer written i18n code. But I plan to provide automatic string replacement and i18n QA in the next versions."
We need your feedback

How might we improve InfoQ for you

Thank you for being an InfoQ reader.

Each year, we seek feedback from our readers to help us improve InfoQ. Would you mind spending 2 minutes to share your feedback in our short survey? Your feedback will directly help us continually evolve how we support you.

Take the Survey

Rate this Article


Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p


Is your profile up-to-date? Please take a moment to review and update.

Note: If updating/changing your email, a validation request will be sent

Company name:
Company role:
Company size:
You will be sent an email to validate the new email address. This pop-up will close itself in a few moments.