EssentialsX

EssentialsX

2M Downloads

enable-locale setting of GeoIP not working with zh

povsister opened this issue · 2 comments

commented

Information

Full output of /ess version:

Server 版本n: 1.15.2-R0.1-SNAPSHOT git-Paper-120 (MC: 1.15.2)
EssentialsX 版本n: 2.17.2.1
LuckPerms 版本n: 5.0.78
Vault 版本n: 1.7.2-b107
Citizens 版本n: 2.0.26-SNAPSHOT (build 1832)
EssentialsXProtect 版本n: 2.17.2.1
EssentialsXGeoIP 版本n: 2.17.2.1
EssentialsXChat 版本n: 2.17.2.1
EssentialsXAntiBuild 版本n: 2.17.2.1
EssentialsXSpawn 版本n: 2.17.2.1

Server log: None

EssentialsX config:

# Set the locale for all messages.
# If you don't set this, the default locale of the server will be used.
# For example, to set language to English, set locale to en, to use the file "messages_en.properties".
# Don't forget to remove the # in front of the line.
# For more information, visit http://wiki.ess3.net/wiki/Locale
locale: zh

EssentialsGeoIP config:

# "enable-locale" enables locale on geolocation display.
# Language is determined by Essentials/config.yml "locale" section.
# Not all languages are supported. See https://dev.maxmind.com/geoip/geoip2/web-services/#Languages
enable-locale: true

Details

Description
enable-locale of GeoIP not working properly. It outputs location in English when locale set to zh

Steps to reproduce
Set the config pasted above.

Expected behavior
It should output localized location when a user sign in. which should be in Chinese Simplified.

Screenshots

image

Troubleshooting
I think this may be caused by mismatched locale string used to represent language by ESS&MaxMind.

ESS uses zh to represent Chinese Simplified. but MaxMind uses zh-CN instead.

Since the locale setting for GeoIP is inherited from ESS. This mismatched value will probably leads to invalid locale lookup using MaxMind database.

commented

Have you tried testing another locale like de or ja instead to see if those work? Is it just zh that is not working?

commented

I tried de. It won't work either.
It seems that the newest GeoIP2 downloadable database contains localized data.
But the ESSGeoIP didn't properly extract it.

Sorry. I must get something wrong in my test.

See https://stackoverflow.com/questions/21041463/get-a-localized-name-of-the-users-city-via-maxmind-geolite2-free

Edit:
It's confirmed that the GeoIP2 downloadable database contains localized data.
I just tried the official python data reader and it works.
image