Commit d67f1a31 authored by Quxl's avatar Quxl

国际化

parent 5ecfe004
...@@ -20,7 +20,11 @@ public class LocaleCookieInterceptor extends HandlerInterceptorAdapter { ...@@ -20,7 +20,11 @@ public class LocaleCookieInterceptor extends HandlerInterceptorAdapter {
Cookie[] cookies = req.getCookies(); Cookie[] cookies = req.getCookies();
for(Cookie cookie : cookies) { for(Cookie cookie : cookies) {
if(cookie.getName().equals(language)) { if(cookie.getName().equals(language)) {
LocaleContextHolder.setLocale(new Locale(cookie.getValue())); String str = cookie.getValue();
String[] kv = str.split("_");
String language = kv[0];
String country = kv.length == 2 ? kv[1] : null;
LocaleContextHolder.setLocale(new Locale(language, country));
} }
} }
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