I am setting the locale for the purpose of translation. It works when the locale stays the same during a session. However, if I change the locale in the middle of a session and reload the page, it stays in the old locale.
Do you know of a way to get the up-to-date language settings from the browser?
My Code:
@SpringUI
@WebServlet(value = "/*", asyncSupported = true)
@VaadinServletConfiguration(productionMode = false, ui = MainUI.class)
public class MainUI extends UI
{
@Override
protected void init(VaadinRequest request)
{
log.debug("MainUI init! locale: {}", getLocale());//or getSession().getLocale()
messageByLocaleService.setLocale(getLocale());
...
I found a solution myself, but I am not 100% sure this is the correct solution.