Internationalizing Vaadin in Grails
We have set up a new Grails project with Vaadin in Chapter 1, Creating a Project in Vaadin. Now let's have a look at how to perform localization.
We will see how to use the i18n
method, which is provided by the Vaadin plugin. In order to do that, we will create a simple application, showing a few texts that will be localized. The first screen on the left-hand side in the following screenshot is localized in the Swedish language. The second one, on the right-hand side, is localized in the English language.
Getting ready
Make sure you have a project using the latest stable version of Grails and Vaadin.
Use grails list-plugin-updates
to get the list of updates for the plugins installed in the project. Alternatively, just run grails install-plugin vaadin
and a new version of the plugin will be installed.
We will place the code in the following section directly into the init
method inside the MyUI
class. The MyUI
class is the generated class by Vaadin plugin, inside...