The internationalization of Django2.0

problem description

Django2.0 internationalization is a multilingual problem. When I was developing locally, multilingual internationalization was perfectly normal and I could switch languages, but internationalization failed when I put it on another ubuntu server. The code and configuration are the same. The ubunt server is a newly built environment, all built from scratch. Internationalized URL is normal, and the translation of the language option I configured on setting is OK, but the translation on the page is invalid.

the environmental background of the problems and what methods you have tried

I have recompiled and produced the translation file django.po,. I don"t know if it has something to do with whether the server system supports Chinese or not. if so, the internationalization of the language option should also be invalid. Now I don"t know what the problem is

.

related codes

/ / Please paste the code text below (do not replace the code with pictures)
LANGUAGE_CODE = "en-us"
TIME_ZONE =" America/Los_Angeles"
USE_I18N = True
USE_L10N = True
USE_TZ = True
LANGUAGES = [

("en-us", "English"),
("zh-hans", ""),

]

LOCALE_PATHS = (

)
os.path.join(BASE_DIR, "locale"),

)

what result do you expect? What is the error message actually seen?

May.02,2021

has solved a hole in django. Previously, local development was to generate a translation file python manage.py makemessages-l zh_hans, Note that zh_hans is underlined and hans is lowercase , this is not good for other environments. Here, change it to python manage.py makemessages-l zh_Hans, Note that zh_Hans is the initials . Although the problem has been solved, the exact reason is not clear.

Menu