/** * Initialize the Localizer. */ public static void init() { Localizer.setLocaleResolver(() -> { return LocaleContextHolder.getLocale(); }); Localizer.setTimeZoneResolver(() -> { TimeZone tz = null; Page page = ExecutionContext.getPage(); Integer offset = page == null ? null : page.getBrowserInfo("timezoneOffset", Integer.class); if (offset != null) { String id = "GMT" + (offset < 0 ? "-" : "+") + "%02d:%02d"; offset = Math.abs(offset); id = String.format(id, offset / 60, offset % 60); tz = TimeZone.getTimeZone(id); } return tz == null ? TimeZone.getDefault() : tz; }); }