feat: 模块多语言-字典数据

This commit is contained in:
TsMask committed 2023-11-20 18:58:05 +08:00
1 parent a538fa98e7
commit 8b9e4ca240
2 files changed
+22 -2

No files matched your search

+2 -2
View File
@@ -11,7 +11,7 @@ import (
"ems.agt/src/modules/common"
"ems.agt/src/modules/crontask"
"ems.agt/src/modules/monitor"
netelement "ems.agt/src/modules/net_element"
networkelement "ems.agt/src/modules/network_element"
"ems.agt/src/modules/system"
"ems.agt/src/modules/trace"
@@ -117,7 +117,7 @@ func initModulesRoute(app *gin.Engine) {
// 系统模块
system.Setup(app)
// 网元模块
netelement.Setup(app)
networkelement.Setup(app)
// 跟踪模块
trace.Setup(app)
// 调度任务模块--暂无接口
+20
View File
@@ -36,6 +36,26 @@ func LoadLocaleData(language string) []localeItem {
return localeData
}
// ValueKey 值转换键
func ValueKey(language, value string) string {
key := value
if value == "" {
return key
}
arr, ok := localeMap[language]
if !ok || len(arr) == 0 {
arr = LoadLocaleData(language)
}
for _, v := range arr {
if v.Value == value {
key = v.Key
break
}
}
return key
}
// TKey 翻译键
func TKey(language, key string) string {
value := key