多语言-增加西班牙语、俄语和乌兹别克语
This commit is contained in:
@@ -48,4 +48,19 @@ public class I18nMessageAdminVo {
|
||||
*/
|
||||
@ApiModelProperty("葡萄牙语")
|
||||
private String pt;
|
||||
/**
|
||||
* 英语
|
||||
*/
|
||||
@ApiModelProperty("西班牙语")
|
||||
private String es;
|
||||
/**
|
||||
* 英语
|
||||
*/
|
||||
@ApiModelProperty("俄罗斯语")
|
||||
private String ru;
|
||||
/**
|
||||
* 英语
|
||||
*/
|
||||
@ApiModelProperty("乌兹别克语")
|
||||
private String uz;
|
||||
}
|
||||
|
@@ -30,6 +30,9 @@ public class I18nMessageAdminService {
|
||||
Properties arProperties = messageI18nNacosService.getProperties(WebLocaleConfig.Arabic);
|
||||
Properties trProperties = messageI18nNacosService.getProperties(WebLocaleConfig.Turkey);
|
||||
Properties prProperties = messageI18nNacosService.getProperties(WebLocaleConfig.Portuguese);
|
||||
Properties esProperties = messageI18nNacosService.getProperties(WebLocaleConfig.Spanish);
|
||||
Properties ruProperties = messageI18nNacosService.getProperties(WebLocaleConfig.Russian);
|
||||
Properties uzProperties = messageI18nNacosService.getProperties(WebLocaleConfig.Uzbek);
|
||||
for (Object obj : zhProperties.keySet()) {
|
||||
String key = obj.toString();
|
||||
I18nMessageAdminVo admin = new I18nMessageAdminVo();
|
||||
@@ -39,16 +42,22 @@ public class I18nMessageAdminService {
|
||||
admin.setAr(arProperties.getProperty(key));
|
||||
admin.setTr(trProperties.getProperty(key));
|
||||
admin.setPt(prProperties.getProperty(key));
|
||||
admin.setEs(esProperties.getProperty(key));
|
||||
admin.setRu(ruProperties.getProperty(key));
|
||||
admin.setUz(uzProperties.getProperty(key));
|
||||
admins.add(admin);
|
||||
}
|
||||
return admins;
|
||||
}
|
||||
|
||||
public void save(String key, String zh, String en, String ar, String tr, String pt) {
|
||||
public void save(String key, String zh, String en, String ar, String tr, String pt, String es, String ru, String uz) {
|
||||
messageI18nNacosService.saveOrUpdateProperties(WebLocaleConfig.Chinese, key, zh);
|
||||
messageI18nNacosService.saveOrUpdateProperties(WebLocaleConfig.English, key, en);
|
||||
messageI18nNacosService.saveOrUpdateProperties(WebLocaleConfig.Arabic, key, ar);
|
||||
messageI18nNacosService.saveOrUpdateProperties(WebLocaleConfig.Turkey, key, tr);
|
||||
messageI18nNacosService.saveOrUpdateProperties(WebLocaleConfig.Portuguese, key, pt);
|
||||
messageI18nNacosService.saveOrUpdateProperties(WebLocaleConfig.Spanish, key, es);
|
||||
messageI18nNacosService.saveOrUpdateProperties(WebLocaleConfig.Russian, key, ru);
|
||||
messageI18nNacosService.saveOrUpdateProperties(WebLocaleConfig.Uzbek, key, uz);
|
||||
}
|
||||
}
|
||||
|
@@ -46,7 +46,7 @@ public class I18nMessageAdminController {
|
||||
@ApiOperation("保存")
|
||||
@PostMapping("save")
|
||||
public BusiResult<Void> save(I18nMessageAdminVo param) {
|
||||
i18nMessageAdminService.save(param.getKey(), param.getZh(), param.getEn(), param.getAr(), param.getTr(), param.getPt());
|
||||
i18nMessageAdminService.save(param.getKey(), param.getZh(), param.getEn(), param.getAr(), param.getTr(), param.getPt(), param.getEs(), param.getRu(), param.getUz());
|
||||
return BusiResult.success();
|
||||
}
|
||||
}
|
||||
|
@@ -17,8 +17,11 @@ 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 Locale Spanish = new Locale("es");
|
||||
public static Locale Russian = new Locale("ru");
|
||||
public static Locale Uzbek = new Locale("uz");
|
||||
|
||||
public static List<Locale> locales = Arrays.asList(Chinese, English, Arabic, Turkey, Portuguese);
|
||||
public static List<Locale> locales = Arrays.asList(Chinese, English, Arabic, Turkey, Portuguese, Spanish, Russian, Uzbek);
|
||||
|
||||
/**
|
||||
* 国际化默认解析器,默认设置为汉语
|
||||
|
Reference in New Issue
Block a user