Internationalization / overriding Vaadin messages


Is there some way to internationalize or override Vaadin messages ? (e.g. “Communication Problem. Take note of any unsaved data, and click here to continue.”)

Thanks in advance.
Jerry - Brazil

Yeah, just override the static method getSystemMessages() from Application.

Here is one way to do it. Follow the link to get a Zip. The classes read the messages according to the current locale from a ResourceBundle which is built from .properties files. Something like this should be standard, overriding classes to internationalize is just so brutal.

Localized System Messages

Note: I wrote this very early in my Vaadin learning curve. Perhaps others have come up with neater solutions (Kim? Dmitri?) – I just haven’t had the opportunity to look at what they’ve done.

EDIT: updated link to point to new Zip with Apache License.

Just noticed that the license on these files is not what it should be; I will fix the zip with an Apache license when I get a minute. If you need the files right away, assume that its Apache licensed.

EDIT: done. the files are now under the Apache License.

Thanks for the ideas, I’ll be using some suitable variant of this!

Override static method? Joking?

, you approach is clear, but I still don’t understand, how the messages get into GUI. One need to override
(e.g. by extending


Your application indeed needs to implement getSystemMessages. See the file in the zip I created as an example. The following comment is from the source for Application

     * Gets the SystemMessages for this application. SystemMessages are used to
     * notify the user of various critical situations that can occur, such as
     * session expiration, client/server out of sync, and internal server error.
     * You can customize the messages by "overriding" this method and returning
     * {@link CustomizedSystemMessages}. To "override" this method, re-implement
     * this method in your application (the class that extends
     * {@link Application}). Even though overriding static methods is not
     * possible in Java, Vaadin selects to call the static method from the
     * subclass instead of the original {@link #getSystemMessages()} if such a
     * method exists.
     * @return the SystemMessages for this application

So when the application fires up, it gets the localized messages when it calls getSystemMessages().

As to where the messages are defined, the class uses standard Java resource bundles. In the example code, you see that the bundle is called “i18n.messages”. This means that I have a directory i18n in my structure (under maven, java/resources/i18n ; under regular eclipse, src/i18n). In the i18n directory there are files called
(and so on). This is described in the Java documentation for ResourceBundle.

There are also some messages that seems to be hard-coded, eg.

“Invalid status code 0 (server down?)”

That seems to be coded in

                        switch (statusCode) {
                        case 0:
                            showCommunicationError("Invalid status code 0 (server down?)");


How can I localize this or get rid of it?

We have the same problem with hardcoded messages in ApplicationConnection class. Can anybody give us a hint?

Answered (and ticket created)
in this thread