葡萄牙语-后端

This commit is contained in:
khalil
2025-07-15 11:02:50 +08:00
parent 90be8f1070
commit ecd9e446cc
7 changed files with 37 additions and 38 deletions

View File

@@ -180,7 +180,7 @@ public class I18NMessageSourceUtil {
field.set(obj, zhValue);
}
}
if (refreshLocalSet.size() > 0) {
if (!refreshLocalSet.isEmpty()) {
messageI18nNacosService.refreshForce(refreshLocalSet);
}
//SpringContextHolder.getBean(I18nMessageNacosAutoConfig.class).initTip();

View File

@@ -16,16 +16,9 @@ public class WebLocaleConfig implements WebMvcConfigurer {
// 阿拉伯语
public static Locale Arabic = new Locale("ar");
public static Locale Turkey = new Locale("tr");
public static Locale Portuguese = new Locale("pt");
public static List<Locale> locales = Arrays.asList(Chinese, English, Arabic, Turkey);
public static Map<String, Locale> localeMap = new HashMap<>();
static {
localeMap.put(Chinese.getLanguage(), Chinese);
localeMap.put(English.getLanguage(), English);
localeMap.put(Arabic.getLanguage(), Arabic);
localeMap.put(Turkey.getLanguage(), Turkey);
}
public static List<Locale> locales = Arrays.asList(Chinese, English, Arabic, Turkey, Portuguese);
/**
* 国际化默认解析器,默认设置为汉语

View File

@@ -13,6 +13,7 @@ public enum PartitionEnum {
CHINESE(4, "Asia/Hong_Kong", "中文区", "zh", Constant.ClanMode.CLAN_HALL),
TURKEY(8, "Europe/Istanbul", "土耳其区", "tr", Constant.ClanMode.GUILD),
ENGLISH2(16, "Asia/Manila", "英语2区", "en", Constant.ClanMode.GUILD),
PORTUGUESE(32, "America/Sao_Paulo", "葡萄牙语区", "pr", Constant.ClanMode.GUILD),
;
private final int id;

View File

@@ -41,26 +41,16 @@ public class MessageI18nNacosService implements InitializingBean {
@Getter
private ConfigService i18nNacosConfigService;
/**
* 国际化英文配置属性文件
*/
public static final String MESSAGES_EN_CONF_DATA_ID = "messages_en.properties";
/**
* 国际化阿拉伯语语配置属性文件
*/
public static final String MESSAGES_AR_CONF_DATA_ID = "messages_ar.properties";
/**
* 国际化中文配置属性文件
*/
public static final String MESSAGES_ZH_CONF_DATA_ID = "messages_zh.properties";
/**
* 国际化中文配置属性文件
*/
public static final String MESSAGES_TR_CONF_DATA_ID = "messages_tr.properties";
private static final String GROUP = "DEFAULT_GROUP";
@SneakyThrows
public boolean saveOrUpdateProperties(Locale locale, String key, String value) {
// 创建Nacos配置服务实例
String messageId = getMessageFileName(locale.getLanguage());
return saveOrUpdateProperties(key, value, messageId);
}
/**
* 修改或者更新国际化数据
*
@@ -85,6 +75,12 @@ public class MessageI18nNacosService implements InitializingBean {
newContent);
}
@SneakyThrows
public Properties getProperties(Locale locale) {
String messageId = getMessageFileName(locale.getLanguage());
return getProperties(messageId);
}
@SneakyThrows
public Properties getProperties(String messageId) {
// 创建Nacos配置服务实例