Commit ef25ba14 LN

增加法语和德语。

1 个父辈 4588e018
...@@ -21,10 +21,8 @@ import org.springframework.security.access.prepost.PreAuthorize; ...@@ -21,10 +21,8 @@ import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.ArrayList; import javax.servlet.http.HttpServletRequest;
import java.util.List; import java.util.*;
import java.util.Map;
import java.util.Set;
@Slf4j @Slf4j
@RestController @RestController
...@@ -36,22 +34,37 @@ public class LanguageSetController { ...@@ -36,22 +34,37 @@ public class LanguageSetController {
@Autowired @Autowired
DataCache dataCache; DataCache dataCache;
public List<LanguageInfo> getAllLanList() { public List<LanguageInfo> getAllLanList( ) {
return getAllLanList(MessageUtils.getDefaultLocal());
}
public List<LanguageInfo> getAllLanList(Locale locale) {
// List<LanguageInfo> lanList = dataCache.getCache(Constants.CACHE_languageType); // List<LanguageInfo> lanList = dataCache.getCache(Constants.CACHE_languageType);
// if (lanList == null || lanList.size() <= 0) { // if (lanList == null || lanList.size() <= 0) {
// lanList = MessageUtils.getDefaultLanList(); // lanList = MessageUtils.getDefaultLanList();
// dataCache.updateCache(Constants.CACHE_languageType, lanList); // dataCache.updateCache(Constants.CACHE_languageType, lanList);
// } // }
return dataCache.getLanguageList(); if(locale==null){
locale= MessageUtils.getDefaultLocal();
}
List<LanguageInfo> lanList = dataCache.getLanguageList();
//没有缩写的加上
for (int i = 0; i < lanList.size(); i++) {
String disName = MessageUtils.getText("smfcore.language.displayLanName." + lanList.get(i).getLanCode(), locale, "");
if (ObjectUtil.isEmpty(lanList.get(i).getDisplayLanName())) {
lanList.get(i).setDisplayLanName(disName);
}
}
return lanList;
} }
@ApiOperation("获取语言列表") @ApiOperation("获取语言列表")
@GetMapping @GetMapping
@AnonymousAccess @AnonymousAccess
// @PreAuthorize("@el.check('translation')") // @PreAuthorize("@el.check('translation')")
public List<LanguageInfo> getList(){ public List<LanguageInfo> getList(HttpServletRequest request){
return getAllLanList(); return getAllLanList(request.getLocale());
} }
@ApiOperation("新增语言") @ApiOperation("新增语言")
@PostMapping @PostMapping
......
...@@ -24,6 +24,12 @@ public class LanguageInfo implements Serializable { ...@@ -24,6 +24,12 @@ public class LanguageInfo implements Serializable {
private String lanName; private String lanName;
/** /**
* 登录界面显示的语言名称,简写
*/
@ApiModelProperty("登录界面显示文本:CN,EN 等")
private String displayLanName;
/**
* 语言图标 * 语言图标
*/ */
@ApiModelProperty("语言图标") @ApiModelProperty("语言图标")
......
...@@ -85,6 +85,8 @@ public class MessageUtils { ...@@ -85,6 +85,8 @@ public class MessageUtils {
public static final String ZH_TW = "zh-TW"; public static final String ZH_TW = "zh-TW";
public static final String EN_US = "en-US"; public static final String EN_US = "en-US";
public static final String JA_JP = "ja-JP"; public static final String JA_JP = "ja-JP";
public static final String FR_FR="fr-FR";
public static final String DE_DE="de-DE";
//服务器type //服务器type
public static final String smfcore="smfcore"; public static final String smfcore="smfcore";
...@@ -227,10 +229,12 @@ public class MessageUtils { ...@@ -227,10 +229,12 @@ public class MessageUtils {
List<LanguageInfo> lanList = new ArrayList<>(); List<LanguageInfo> lanList = new ArrayList<>();
if (lanList == null || lanList.size() <= 0) { if (lanList == null || lanList.size() <= 0) {
lanList=new ArrayList<>(); lanList=new ArrayList<>();
lanList.add(new LanguageInfo(MessageUtils.ZH_CN,"简体中文","")); lanList.add(new LanguageInfo(MessageUtils.ZH_CN,"简体中文","CN",""));
lanList.add(new LanguageInfo(MessageUtils.ZH_TW,"繁体中文","")); lanList.add(new LanguageInfo(MessageUtils.ZH_TW,"繁体中文","TW",""));
lanList.add(new LanguageInfo(MessageUtils.EN_US,"English","")); lanList.add(new LanguageInfo(MessageUtils.EN_US,"English","EN",""));
lanList.add(new LanguageInfo(MessageUtils.JA_JP,"日本语","")); lanList.add(new LanguageInfo(MessageUtils.JA_JP,"日本语","JP",""));
lanList.add(new LanguageInfo(MessageUtils.FR_FR,"Français","FR",""));
lanList.add(new LanguageInfo(MessageUtils.DE_DE,"Deutsch","DE",""));
} }
return lanList; return lanList;
} }
......
...@@ -414,4 +414,10 @@ smfcore.equipApiMsg.response=\u7ED3\u679C\u4FE1\u606F ...@@ -414,4 +414,10 @@ smfcore.equipApiMsg.response=\u7ED3\u679C\u4FE1\u606F
smfcore.equipApiMsg.updateTime=\u65F6\u95F4 smfcore.equipApiMsg.updateTime=\u65F6\u95F4
smfcore.equipApiMsg.state=\u7C7B\u578B smfcore.equipApiMsg.state=\u7C7B\u578B
smfcore.equipment.view.nsgroup=Neo Scan smfcore.equipment.view.nsgroup=Neo Scan
smfcore.equipment.view.apigroup=Pick and Place Machine
\ No newline at end of file \ No newline at end of file
smfcore.equipment.view.apigroup=Pick and Place Machine
smfcore.language.displayLanName.zh-CN=CN
smfcore.language.displayLanName.zh-TW=TW
smfcore.language.displayLanName.en-US=US
smfcore.language.displayLanName.ja-JP=JP
smfcore.language.displayLanName.fr-FR=FR
smfcore.language.displayLanName.de-DE=DE
\ No newline at end of file \ No newline at end of file
...@@ -405,4 +405,10 @@ smfcore.equipApiMsg.response=Result/Details ...@@ -405,4 +405,10 @@ smfcore.equipApiMsg.response=Result/Details
smfcore.equipApiMsg.updateTime=Time smfcore.equipApiMsg.updateTime=Time
smfcore.equipApiMsg.state=Type smfcore.equipApiMsg.state=Type
smfcore.equipment.view.nsgroup=Neo Scan smfcore.equipment.view.nsgroup=Neo Scan
smfcore.equipment.view.apigroup=Pick and Place Machine
\ No newline at end of file \ No newline at end of file
smfcore.equipment.view.apigroup=Pick and Place Machine
smfcore.language.displayLanName.zh-CN=CN
smfcore.language.displayLanName.zh-TW=TW
smfcore.language.displayLanName.en-US=US
smfcore.language.displayLanName.ja-JP=JP
smfcore.language.displayLanName.fr-FR=FR
smfcore.language.displayLanName.de-DE=DE
\ No newline at end of file \ No newline at end of file
...@@ -402,3 +402,9 @@ smfcore.equipApiMsg.updateTime=\u6642\u9593 ...@@ -402,3 +402,9 @@ smfcore.equipApiMsg.updateTime=\u6642\u9593
smfcore.equipApiMsg.state=\u30B9\u30C6\u30FC\u30BF\u30B9 smfcore.equipApiMsg.state=\u30B9\u30C6\u30FC\u30BF\u30B9
smfcore.equipment.view.nsgroup=\u30CD\u30AA\u30B9\u30AD\u30E3\u30F3 smfcore.equipment.view.nsgroup=\u30CD\u30AA\u30B9\u30AD\u30E3\u30F3
smfcore.equipment.view.apigroup=\u30D4\u30C3\u30AF\u30A2\u30F3\u30C9\u30D7\u30EC\u30FC\u30B9\u30DE\u30B7\u30F3 smfcore.equipment.view.apigroup=\u30D4\u30C3\u30AF\u30A2\u30F3\u30C9\u30D7\u30EC\u30FC\u30B9\u30DE\u30B7\u30F3
smfcore.language.displayLanName.zh-CN=CN
smfcore.language.displayLanName.zh-TW=TW
smfcore.language.displayLanName.en-US=US
smfcore.language.displayLanName.ja-JP=JP
smfcore.language.displayLanName.fr-FR=FR
smfcore.language.displayLanName.de-DE=DE
...@@ -401,4 +401,10 @@ smfcore.equipApiMsg.response=\u7ED3\u679C\u4FE1\u606F ...@@ -401,4 +401,10 @@ smfcore.equipApiMsg.response=\u7ED3\u679C\u4FE1\u606F
smfcore.equipApiMsg.updateTime=\u65F6\u95F4 smfcore.equipApiMsg.updateTime=\u65F6\u95F4
smfcore.equipApiMsg.state=\u7C7B\u578B smfcore.equipApiMsg.state=\u7C7B\u578B
smfcore.equipment.view.nsgroup=Neo Scan smfcore.equipment.view.nsgroup=Neo Scan
smfcore.equipment.view.apigroup=Pick and Place Machine
\ No newline at end of file \ No newline at end of file
smfcore.equipment.view.apigroup=Pick and Place Machine
smfcore.language.displayLanName.zh-CN=CN
smfcore.language.displayLanName.zh-TW=TW
smfcore.language.displayLanName.en-US=US
smfcore.language.displayLanName.ja-JP=JP
smfcore.language.displayLanName.fr-FR=FR
smfcore.language.displayLanName.de-DE=DE
\ No newline at end of file \ No newline at end of file
...@@ -401,4 +401,10 @@ smfcore.equipApiMsg.response=\u7ED3\u679C\u4FE1\u606F ...@@ -401,4 +401,10 @@ smfcore.equipApiMsg.response=\u7ED3\u679C\u4FE1\u606F
smfcore.equipApiMsg.updateTime=\u65F6\u95F4 smfcore.equipApiMsg.updateTime=\u65F6\u95F4
smfcore.equipApiMsg.state=\u7C7B\u578B smfcore.equipApiMsg.state=\u7C7B\u578B
smfcore.equipment.view.nsgroup=Neo Scan smfcore.equipment.view.nsgroup=Neo Scan
smfcore.equipment.view.apigroup=Pick and Place Machine
\ No newline at end of file \ No newline at end of file
smfcore.equipment.view.apigroup=Pick and Place Machine
smfcore.language.displayLanName.zh-CN=CN
smfcore.language.displayLanName.zh-TW=TW
smfcore.language.displayLanName.en-US=US
smfcore.language.displayLanName.ja-JP=JP
smfcore.language.displayLanName.fr-FR=FR
smfcore.language.displayLanName.de-DE=DE
\ No newline at end of file \ No newline at end of file
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!