List of usage examples for com.vaadin.server VaadinSession setLocale
public void setLocale(Locale locale)
From source file:com.haulmont.cuba.web.App.java
License:Apache License
/** * Called when <em>the first</em> UI of the session is initialized. *///from www . j a v a 2 s . c o m protected void init(Locale requestLocale) { VaadinSession vSession = VaadinSession.getCurrent(); vSession.setAttribute(App.class, this); vSession.setLocale(messageTools.getDefaultLocale()); // set root error handler for all session vSession.setErrorHandler(event -> { try { getExceptionHandlers().handle(event); getAppLog().log(event); } catch (Throwable e) { //noinspection ThrowableResultOfMethodCallIgnored log.error("Error handling exception\nOriginal exception:\n{}\nException in handlers:\n{}", ExceptionUtils.getStackTrace(event.getThrowable()), ExceptionUtils.getStackTrace(e)); } }); appLog = new AppLog(); connection = createConnection(); exceptionHandlers = new ExceptionHandlers(this); cookies = new AppCookies(); themeConstants = loadTheme(); VaadinServlet vaadinServlet = VaadinServlet.getCurrent(); ServletContext sc = vaadinServlet.getServletContext(); String resourcesTimestamp = sc.getInitParameter("webResourcesTs"); if (StringUtils.isNotEmpty(resourcesTimestamp)) { this.webResourceTimestamp = resourcesTimestamp; } log.debug("Initializing application"); // get default locale from config Locale targetLocale = resolveLocale(requestLocale); setLocale(targetLocale); }