Commit 92bc2456 authored by Quxl's avatar Quxl

ff

parent d67f1a31
...@@ -10,6 +10,8 @@ import org.springframework.context.i18n.LocaleContextHolder; ...@@ -10,6 +10,8 @@ import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import com.egolm.common.StringUtil;
@Component @Component
public class LocaleCookieInterceptor extends HandlerInterceptorAdapter { public class LocaleCookieInterceptor extends HandlerInterceptorAdapter {
...@@ -21,6 +23,9 @@ public class LocaleCookieInterceptor extends HandlerInterceptorAdapter { ...@@ -21,6 +23,9 @@ public class LocaleCookieInterceptor extends HandlerInterceptorAdapter {
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();
if(StringUtil.isBlank(str)) {
str = "zh_CN";
}
String[] kv = str.split("_"); String[] kv = str.split("_");
String language = kv[0]; String language = kv[0];
String country = kv.length == 2 ? kv[1] : null; String country = kv.length == 2 ? kv[1] : null;
......
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