1
0

feat: 多语言处理tkey

This commit is contained in:
TsMask
2023-11-21 14:42:37 +08:00
parent f490d9af0f
commit d5d3feb5fc
61 changed files with 1381 additions and 757 deletions

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