protected Locale getLocale(Context context) {
ServletWebContext swcontext = (ServletWebContext) context;
// Has a Locale already been selected?
HttpSession session = swcontext.getRequest().getSession();
Locale locale = (Locale) session.getAttribute(Globals.LOCALE_KEY);
if (locale != null) {
return (locale);
}
// Select and cache the Locale to be used
locale = swcontext.getRequest().getLocale();
if (locale == null) {
locale = Locale.getDefault();
}
session.setAttribute(Globals.LOCALE_KEY, locale);
return (locale);
}
|