feat: 模块多语言-字典数据
This commit is contained in:
@@ -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