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

@@ -43,7 +43,7 @@ func RegionSearchByIp(ip string) (string, int, int64) {
ip = ClientIP(ip)
if ip == LOCAT_HOST {
// "0|0|0|内网IP|内网IP"
return "0|0|0|Intranet IP|Intranet IP", 0, 0
return "0|0|0|app.common.noIPregion|app.common.noIPregion", 0, 0
}
tStart := time.Now()
region, err := searcher.SearchByStr(ip)
@@ -60,19 +60,19 @@ func RegionSearchByIp(ip string) (string, int, int64) {
func RealAddressByIp(ip string) string {
ip = ClientIP(ip)
if ip == LOCAT_HOST {
return "Intranet IP" // 内网IP
return "app.common.noIPregion" // 内网IP
}
region, err := searcher.SearchByStr(ip)
if err != nil {
logger.Errorf("failed to SearchIP(%s): %s\n", ip, err)
return "unknown" // 未知
return "app.common.unknown" // 未知
}
parts := strings.Split(region, "|")
province := parts[2]
city := parts[3]
if province == "0" && city != "0" {
if city == "内网IP" {
return "Intranet IP" // 内网IP
return "app.common.noIPregion" // 内网IP
}
return city
}