String resources i18n

Hi guys,
I just started with Vaadin - i come from Wicket - and i really like how easy it was to set up my webapp.

Where should i put my string resources like captions, explanations and in general all text that goes with my components? I see a lot of people put it directly into the java code but that way it is all scattered over different classes. I like to have it all in one place, in previous projects we even sometimes provided the client with screenshots where texts were circled and numbered referencing the string in a resource textfile. That way whoever was maintaining the app could easily make user-requested changes.
A seperate resource file also makes internationalisation do-able.


You can use common Java techniques for i18n with Vaadin, such as ResourceBundles.

There’s a
simple example
, and a complete example in the Gas Diary example:


- base resource bundle with all the message IDs as constants.
- English messages
- Finnish messages
- the application class provides some access methods to the resource bundle of the current locale
- handles switching the locale

on-line demo
- select the language on the start page (username demo, password demo)

[/list]The resources are used for example as follows:

Button register = new Button(app.getMessage(GasDiaryMessages.RegisterNewUser));

In this example application, the messages are written in a ListResourceBundle hard-coded in Java files. If you want to have them in non-Java files, you could use PropertyResourceBundles or implement some other bundle type.

Take a look at the
add-on, it provides an easy to use
i18n module

As well as to
add-on, also provides i18n technique. So you’ll have a bunch of choices :wink:

Thanks - all you guys! Its nice to see the Vaadin forum is as quick as the wicket maillinglist :wink: