invalid locale zh-hans, did you mean zh_HAns?

When I run command in the shell:

django-admin makemessages -l zh-hans

errors like:

invalid locale zh-hans, did you mean zh_HAns?

why?

my settings.py like:

LANGUAGE_CODE = ‘zh-hans’
TIME_ZONE = ‘Asia/Shanghai’
USE_I18N = True
USE_L10N = True
USE_TZ = True
LANGUAGES = [
(‘zh-hans’, _(“Simplified Chinese”)),
(‘mn-mong’, _(“Traditional Mongolian”)),
]
LOCALE_PATHS = [
BASE_DIR / ‘locale’,
]

I believe the value should be zh_Hans or zh_CN. Notice the underscore instead of the hyphen.

The capitalization you are seeing is due to the makemessages module incorrectly parsing the locale for a territory on lines 431-438, which doesn’t apply in this case for zh_Hans.