Commit 1e9a9928 LN

语言获取修改

1 个父辈 2b19b110
...@@ -83,10 +83,10 @@ public class GlobalExceptionHandler { ...@@ -83,10 +83,10 @@ public class GlobalExceptionHandler {
@ExceptionHandler(value = ValidateException.class) @ExceptionHandler(value = ValidateException.class)
public ResponseEntity<ApiError> validateException(HttpServletRequest servlet,ValidateException e){ public ResponseEntity<ApiError> validateException(HttpServletRequest servlet,ValidateException e){
String language= servlet.getLocale().getLanguage(); // String language= servlet.getLocale().getLanguage();
// 打印堆栈信息 // 打印堆栈信息
//log.error(ThrowableUtil.getStackTrace(e)); //log.error(ThrowableUtil.getStackTrace(e));
String targetMsg=messageUtils.getText(e.getMsgKey(),e.getMsgParam(),new Locale(language) ,e.getDefaultMsg()); String targetMsg=messageUtils.getText(e.getMsgKey(),e.getMsgParam(),servlet.getLocale() ,e.getDefaultMsg());
return buildResponseEntity(ApiError.error(e.getStatus(),targetMsg)); return buildResponseEntity(ApiError.error(e.getStatus(),targetMsg));
} }
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!