Jonas Helming, Maximilian Koegel and Philip Langer co-lead EclipseSource. They work as consultants and software engineers for building …
EMF Forms 1.6.0 Feature: LocalizationJune 29, 2015 | 2 min Read
Two weeks ago, we released EMF Forms 1.6.0. EMF Forms makes it really simple to create forms, which edit your data based on an EMF model. To get started with EMF Forms please refer to our tutorial.
In the 1.6.0, we have added a long desired feature to the framework: View Model Localization. To be fair: that does not mean forms created with EMF Forms were not localizable before. All strings in dialogs and labels were externalized in previous releases, so it was possible to translate them. However, it was not possible to translate strings, which were derived from the view model itself, e.g. the title of groups. Furthermore, as EMF Forms relied on the standard Java NSL mechnism, it was not possible to switch the locale at runtime. In EMF Forms 1.6.0, both issues are fixed. First, we refactored the localization to use Java ResourceBundles and the OSGi Localization. Thereby, EMF Forms supports dynamic locale switching during runtime, which is especially important for Web Applications. This means that the locale can be switched at runtime on already rendered forms. EMF Forms will take care to update all required UI elements accordingly.
Second, we added internationalization support to the view model. For all visible strings, e.g. the title of a group, you can use IDs instead of strings:
As for all other translations, the actual strings are delivered in property files:
Those properties are then picked-up at runtime depending on the current locale:
Please have a look at this tutorial to learn about all the details on localization in EMF Forms 1.6.0.