Get better country and subdivision names

This commit is contained in:
Noah Petherbridge 2023-08-15 21:08:07 -07:00
parent 001477de61
commit dc5b82b59a

View File

@ -75,7 +75,7 @@ func GetChatFlagEmoji(r *http.Request) (string, error) {
var flags = []string{} var flags = []string{}
// The country. Name or ISO code? // 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) flags = append(flags, name)
} else { } else {
flags = append(flags, city.Country.IsoCode) flags = append(flags, city.Country.IsoCode)
@ -85,7 +85,7 @@ func GetChatFlagEmoji(r *http.Request) (string, error) {
if len(city.Subdivisions) > 0 { if len(city.Subdivisions) > 0 {
for _, sub := range city.Subdivisions { for _, sub := range city.Subdivisions {
// Can we get its name? // Can we get its name?
if name, ok := sub.Names[sub.IsoCode]; ok { if name, ok := sub.Names["en"]; ok {
flags = append(flags, name) flags = append(flags, name)
} else { } else {
flags = append(flags, sub.IsoCode) flags = append(flags, sub.IsoCode)