Commit 8b819a24 authored by Quxl's avatar Quxl

xx

parent 92bc2456
...@@ -20,6 +20,7 @@ public class LocaleCookieInterceptor extends HandlerInterceptorAdapter { ...@@ -20,6 +20,7 @@ public class LocaleCookieInterceptor extends HandlerInterceptorAdapter {
@Override @Override
public boolean preHandle(HttpServletRequest req, HttpServletResponse resp, Object handler) throws Exception { public boolean preHandle(HttpServletRequest req, HttpServletResponse resp, Object handler) throws Exception {
Cookie[] cookies = req.getCookies(); Cookie[] cookies = req.getCookies();
if(cookies != null && cookies.length > 0) {
for(Cookie cookie : cookies) { for(Cookie cookie : cookies) {
if(cookie.getName().equals(language)) { if(cookie.getName().equals(language)) {
String str = cookie.getValue(); String str = cookie.getValue();
...@@ -30,8 +31,11 @@ public class LocaleCookieInterceptor extends HandlerInterceptorAdapter { ...@@ -30,8 +31,11 @@ public class LocaleCookieInterceptor extends HandlerInterceptorAdapter {
String language = kv[0]; String language = kv[0];
String country = kv.length == 2 ? kv[1] : null; String country = kv.length == 2 ? kv[1] : null;
LocaleContextHolder.setLocale(new Locale(language, country)); LocaleContextHolder.setLocale(new Locale(language, country));
return super.preHandle(req, resp, handler);
}
} }
} }
LocaleContextHolder.setLocale(Locale.CHINA);
return super.preHandle(req, resp, handler); return super.preHandle(req, resp, handler);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment