1
0

merge: 合并代码

This commit is contained in:
TsMask
2024-04-30 20:37:27 +08:00
parent 78bd110b03
commit 3cc193f57d
95 changed files with 3028 additions and 1519 deletions

View File

@@ -3,6 +3,7 @@ package i18n
import (
"fmt"
"regexp"
"strings"
systemService "be.ems/src/modules/system/service"
)
@@ -70,6 +71,26 @@ func UpdateKeyValue(language, key, value string) bool {
return false
}
// TFindKeyPrefix 翻译值查找键 值前缀匹配
func TFindKeyPrefix(language, keyPrefix, 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 strings.HasPrefix(v.Key, keyPrefix) && strings.HasPrefix(v.Value, value) {
key = v.Key
break
}
}
return key
}
// TKey 翻译键
func TKey(language, key string) string {
value := key