Django框架开发项目时,在settings.py中设置 中文 语言时报错:
LANGUAGE_CODE = 'zh-Hans'
报错:ERRORS:
?: (translation.E004) You have provided a value for the LANGUAGE_CODE setting that is not in the LANGUAGES setting.
处理办法,头部引入:
from django.utils.translation import gettext_lazy as _
在LANGUAGE_CODE = 'zh-Hans' 上方添加:
LANGUAGES = [ ('zh-Hans', _('Chinese')), ]