From dc5b82b59aa091d6ad5431d465c9e236c8b3b90c Mon Sep 17 00:00:00 2001 From: Noah Petherbridge Date: Tue, 15 Aug 2023 21:08:07 -0700 Subject: [PATCH] Get better country and subdivision names --- pkg/geoip/geoip.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/geoip/geoip.go b/pkg/geoip/geoip.go index 2d30a4f..14c53a9 100644 --- a/pkg/geoip/geoip.go +++ b/pkg/geoip/geoip.go @@ -75,7 +75,7 @@ func GetChatFlagEmoji(r *http.Request) (string, error) { var flags = []string{} // The country. Name or ISO code? - if name, ok := city.Country.Names[city.Country.IsoCode]; ok { + if name, ok := city.Country.Names["en"]; ok { flags = append(flags, name) } else { flags = append(flags, city.Country.IsoCode) @@ -85,7 +85,7 @@ func GetChatFlagEmoji(r *http.Request) (string, error) { if len(city.Subdivisions) > 0 { for _, sub := range city.Subdivisions { // Can we get its name? - if name, ok := sub.Names[sub.IsoCode]; ok { + if name, ok := sub.Names["en"]; ok { flags = append(flags, name) } else { flags = append(flags, sub.IsoCode)