/** * Change the language of imeji * * @param languageString */ private void changeLanguage(String languageString) { if (isSupported(languageString)) { currentLanguage = languageString; } else { currentLanguage = getRequestedLocale().getLanguage(); } session.setLocale(new Locale(currentLanguage)); CookieUtils.updateCookieValue(SessionBean.langCookieName, session.getLocale().getLanguage()); internationalizeLanguages(); }
/** * If the user already set a lang cookie, return its value, else check the lang in the request * (browser dependant) * * @return */ public static Locale getUserLocale() { return Locale.forLanguageTag( CookieUtils.readNonNull(SessionBean.langCookieName, getRequestedLocale().getLanguage())); }