Skip to content

Commit

Permalink
fix: Geoip lang select
Browse files Browse the repository at this point in the history
Signed-off-by: zu1k <[email protected]>
  • Loading branch information
zu1k committed May 9, 2022
1 parent 45878d4 commit 9e049a4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pkg/geoip/geoip.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import (
"net"
"os"

"github.com/spf13/viper"

"github.com/oschwald/geoip2-golang"
)

Expand Down Expand Up @@ -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{
Expand Down

0 comments on commit 9e049a4

Please sign in to comment.