Hi,
I’m trying to set up internationalization for my Vaadin 7 webapp on Spring (
SpringVaadinIntegration
add-on).
Currently what I got is:
In spring context:
<bean id="messageSource" class="org.springframework.context.support.
ReloadableResourceBundleMessageSource" autowire="byName">
<property name="defaultEncoding" value="UTF-8" />
<property name="basenames">
<list>
<value>classpath:translations/messages</value>
</list>
</property>
</bean>
And in my UI:
Button flagENbutton = new Button("English", new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
VaadinSession.getCurrent().setLocale(new Locale("en"));
}};
And of course some .properties files in resources/translations dir. I would really like to keep them that way (prefer it over XML etc)
It works almost like I want - setting the Locale for VaadinSession actually is working by changing the properties file from which the strings are taken, but it works only when I reload (refresh) manually the page.
As I did my research over this forum and whole Interwebs, I got some possible solutions, but I’m having problem in realization:
- I found similar topic, but old and referencing to Vaadin6 (
https://vaadin.com/forum#!/thread/178978
), where there is posted GasDiary example of what I want to achieve - its changing Locale and refreshing the V6 “screen”. Is there a simple way to do the same in Vaadin 7? Or how to easy reload all components of the UI, on clicking on language selection button in UI? - I looked at the
I18N4Vaadin
addon, but as I found, there is also need of manual reload of components, so the problem is the same as in no.1. - I looked also on the
AppFoundation i18n module
which looks nice but: it uses XML (I prefer .properties) and I don’t know how about reloading the page to change the strings on currently loaded components.
I would really appreciate any suggestions about my concerns. How this should be done in Vaadin7? Is there a better way than reloading whole page? If so, how? If not, how to properly reload all the components in one method, without going manually through all of the components?