Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Multi-lingual Support by Vaadin Component
I am developing a Portlet 2.0 application using Vaadin. The application is planned to support Multi-lingual. However, when the user changed the language, Vaadin cannot reflect to the target language. The custom layout is using to construct the Vaadin UI. It seems both the custom HTML and components cannot based on the locale to change. In the coding, the Vaadin window was removed and start a new Window, but no effect. Here is the code snap to handle the Portlet Resource Request, where VaadinApplication is an application extends the Application class.
public void handleResourceRequest(ResourceRequest request, ResourceResponse response, Window window) {
log.info("handleResourceRequest");
BaseApplication application = BaseApplication.getCurrent();
response.setLocale(application.getLocale());
Locale locale = application.getLocale();
if (locale != null) {
log.info("Application Locale is " + locale);
if (!locale.getLanguage().equals(request.getLocale().getLanguage())) {
log.info("Locale changed to " + request.getLocale());
application.setLocale(request.getLocale());
if (application instanceof VaadinApplication) {
((VaadinApplication) application).localizeDefault();
((VaadinApplication) application).startMainWindow();
}
}
}
The startMainWindow is used to set the main window of Vaadin as below.
public void startMainWindow(){
PortletWindow mainWindow = new PortletWindow(getMenuCodeOfPortletApplication());
setMainWindow(mainWindow);
}
My PortletWindow class will depends on user's locale to construct an Application Main Window. It will remove all components and add components for a new request.
Any idea why remove all component not working? or Vaadin cached? Thanks.