18 package org.turro.zkoss.locale;
20 import java.util.Locale;
21 import javax.servlet.http.Cookie;
22 import javax.servlet.http.HttpServletRequest;
23 import javax.servlet.http.HttpServletResponse;
24 import org.turro.elephant.zkoss.ZkossElephant;
25 import org.zkoss.web.Attributes;
26 import org.zkoss.zk.ui.Session;
27 import org.zkoss.zk.ui.util.RequestInterceptor;
37 final Cookie[] cookies = ((HttpServletRequest)
request).getCookies();
38 if (cookies !=
null) {
39 for (
int j = cookies.length; --j >= 0;) {
40 if (cookies[j].getName().equals(
"lang")) {
41 String val = cookies[j].getValue();
44 if(val.startsWith(
"_")) val = val.substring(1);
45 Locale locale = org.zkoss.util.Locales.getLocale(val);
46 sess.setAttribute(Attributes.PREFERRED_LOCALE, locale);
static ZkossElephant instance(HttpServletRequest request, HttpServletResponse response)
void request(Session sess, Object request, Object response)