* sure you call remove18nInfoFromThread() when the thread is finished!
*
* @param hreq The http servlet request
*/
public static void attachI18nInfoToThread(HttpServletRequest hreq) {
UserSession usess = UserSession.getUserSession(hreq);
if (threadLocalLocale == null) {
I18nManager.getInstance().logError("can't attach i18n info to thread: threadLocalLocale is null", null);
} else {
if (threadLocalLocale.getThreadLocale() != null) {
I18nManager.getInstance().logWarn(
"try to attach i18n info to thread, but threadLocalLocale is not null - a thread forgot to remove it!", new Exception("attachI18nInfoToThread"));
}
threadLocalLocale.setThredLocale(usess.getLocale());
}
if (threadLocalIsMarkLocalizedStringsEnabled == null) {
I18nManager.getInstance().logError("can't attach i18n info to thread: threadLocalIsMarkLocalizedStringsEnabled is null", null);
} else {
if (threadLocalIsMarkLocalizedStringsEnabled.isMarkLocalizedStringsEnabled() != null) {
I18nManager.getInstance().logWarn(
"try to attach i18n info to thread, but threadLocalIsMarkLocalizedStringsEnabled is not null - a thread forgot to remove it!",
null);
}
Boolean isMarkLocalizedStringsEnabled = (Boolean) usess.getEntry(USESS_KEY_I18N_MARK_LOCALIZED_STRINGS);
if (isMarkLocalizedStringsEnabled != null) {
threadLocalIsMarkLocalizedStringsEnabled.setMarkLocalizedStringsEnabled(isMarkLocalizedStringsEnabled);
}
}
}