mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
报表服务新增入参/枚举/错误码i18n国际化整理
This commit is contained in:
+5
@@ -7,6 +7,11 @@ package com.cf.imes.framework.common.constants;
|
||||
* @since 2025/11/21 11:33
|
||||
*/
|
||||
public final class ResourceBundleConstants {
|
||||
/**
|
||||
* 错误码资源包
|
||||
*/
|
||||
public static final String MESSAGE_ERROR_PATH = "message_errorcode";
|
||||
|
||||
/**
|
||||
* 枚举资源包
|
||||
*/
|
||||
|
||||
+14
@@ -6,6 +6,8 @@ import org.springframework.context.MessageSource;
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* 国际化工具类
|
||||
*
|
||||
@@ -29,4 +31,16 @@ public class I18nUtils {
|
||||
public String getMessage(String code, Object... args) {
|
||||
return messageSource.getMessage(code, args, code, LocaleContextHolder.getLocale());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取国际化描述
|
||||
*
|
||||
* @param locale
|
||||
* @param code
|
||||
* @param args
|
||||
* @return
|
||||
*/
|
||||
public String getMessage(Locale locale, String code, Object... args) {
|
||||
return messageSource.getMessage(code, args, code, locale);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ public class ResourceBundleUtils {
|
||||
* @param args 占位符数组
|
||||
* @return
|
||||
*/
|
||||
public static String getMessage(String baseName, String key, String defaultMessage, Locale locale, Object args) {
|
||||
public static String getMessage(String baseName, String key, String defaultMessage, Locale locale, Object... args) {
|
||||
try {
|
||||
ResourceBundle messageEnum = ResourceBundle.getBundle(baseName, locale);
|
||||
if (messageEnum != null) {
|
||||
|
||||
Reference in New Issue
Block a user