1
0
mirror of https://github.com/zu1k/nali.git synced 2025-01-22 13:19:02 +08:00

fix: Geoip lang select

Signed-off-by: zu1k <i@zu1k.com>
This commit is contained in:
zu1k 2022-05-09 14:59:02 +08:00
parent c0643f7731
commit 8078e86156

View File

@ -7,6 +7,8 @@ import (
"net"
"os"
"github.com/spf13/viper"
"github.com/oschwald/geoip2-golang"
)
@ -41,11 +43,9 @@ func (g GeoIP) Find(query string, params ...string) (result fmt.Stringer, err er
return
}
lang := "zh-CN"
if len(params) > 0 {
if _, ok := record.Country.Names[params[0]]; ok {
lang = params[0]
}
lang := viper.GetString("selected.lang")
if lang == "" {
lang = "zh-CN"
}
result = Result{