mirror of
https://gitee.com/durcframework/SOP.git
synced 2025-08-11 21:57:56 +08:00
4.2.5
This commit is contained in:
@@ -7,6 +7,7 @@ import org.springframework.context.support.ResourceBundleMessageSource;
|
|||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -33,6 +34,8 @@ public class ErrorFactory {
|
|||||||
|
|
||||||
private static Map<String, Error> errorCache = new HashMap<>(64);
|
private static Map<String, Error> errorCache = new HashMap<>(64);
|
||||||
|
|
||||||
|
private static List<Locale> localeList = Arrays.asList(Locale.ENGLISH, Locale.SIMPLIFIED_CHINESE);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 错误信息的国际化信息
|
* 错误信息的国际化信息
|
||||||
*/
|
*/
|
||||||
@@ -70,6 +73,9 @@ public class ErrorFactory {
|
|||||||
if (locale == null) {
|
if (locale == null) {
|
||||||
locale = Locale.SIMPLIFIED_CHINESE;
|
locale = Locale.SIMPLIFIED_CHINESE;
|
||||||
}
|
}
|
||||||
|
if (!localeList.contains(locale)) {
|
||||||
|
locale = Locale.ENGLISH;
|
||||||
|
}
|
||||||
String key = errorMeta.getModulePrefix() + errorMeta.getCode() + errorMeta.getSubCode() + locale.toString();
|
String key = errorMeta.getModulePrefix() + errorMeta.getCode() + errorMeta.getSubCode() + locale.toString();
|
||||||
Error error = errorCache.get(key);
|
Error error = errorCache.get(key);
|
||||||
if (error == null) {
|
if (error == null) {
|
||||||
|
Reference in New Issue
Block a user