feat: 模块多语言-字典数据
This commit is contained in:
@@ -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)
|
||||
// 调度任务模块--暂无接口
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user