}
public void checkSessionLocale(HttpServletRequest httpRequest) {
String languageId = String.valueOf(langAPI.getDefaultLanguage().getId());
Language currentLang = langAPI.getLanguage(languageId);
Locale locale = new Locale(currentLang.getLanguageCode(), currentLang.getCountryCode());
HttpSession session = httpRequest.getSession();
// set default page language
if (UtilMethods.isSet((String) session.getAttribute(com.dotmarketing.util.WebKeys.HTMLPAGE_LANGUAGE))) {
languageId = (String) session.getAttribute(com.dotmarketing.util.WebKeys.HTMLPAGE_LANGUAGE);
currentLang = langAPI.getLanguage(languageId);
locale = new Locale(currentLang.getLanguageCode(), currentLang.getCountryCode());
}
// update page language
if (UtilMethods.isSet(httpRequest.getParameter(com.dotmarketing.util.WebKeys.HTMLPAGE_LANGUAGE))
|| UtilMethods.isSet(httpRequest.getParameter("language_id"))
|| UtilMethods.isSet(httpRequest.getAttribute(WebKeys.HTMLPAGE_LANGUAGE))) {
if (UtilMethods.isSet(httpRequest.getParameter(WebKeys.HTMLPAGE_LANGUAGE))) {
languageId = httpRequest.getParameter(WebKeys.HTMLPAGE_LANGUAGE);
} else if(UtilMethods.isSet(httpRequest.getAttribute(WebKeys.HTMLPAGE_LANGUAGE))) {
languageId = (String)httpRequest.getAttribute(WebKeys.HTMLPAGE_LANGUAGE);
}
else {
languageId = httpRequest.getParameter("language_id");
}
currentLang = langAPI.getLanguage(languageId);
locale = new Locale(currentLang.getLanguageCode(), currentLang.getCountryCode());
}
session.setAttribute(WebKeys.HTMLPAGE_LANGUAGE, languageId);
httpRequest.setAttribute(WebKeys.HTMLPAGE_LANGUAGE, languageId);