TASK: 枚举类多语言;
This commit is contained in:
@@ -53,7 +53,11 @@ public class BusinessException extends RuntimeException {
|
||||
return new Locale(Language.valueOf(userInfo.getLanguage()).getValue());
|
||||
}
|
||||
|
||||
private static String getMessageFromResource(String msg, Locale userLocale) {
|
||||
public static String getMessageFromResource(String msg) {
|
||||
return getMessageFromResource(msg, getUserLocale());
|
||||
}
|
||||
|
||||
public static String getMessageFromResource(String msg, Locale userLocale) {
|
||||
try (InputStream inputStream = BusinessException.class.getClassLoader().getResourceAsStream("messages_" + userLocale.getLanguage() + ".properties")) {
|
||||
if (inputStream != null) {
|
||||
ResourceBundle bundle = new PropertyResourceBundle(new InputStreamReader(inputStream, StandardCharsets.UTF_8));
|
||||
|
||||
Reference in New Issue
Block a user