4👍
You should use:
LANGUAGE_CODE = ‘zh-hans’
Also when you use django-admin makemessages -l zh_hans
Note: one is zh-hans, one is zh_hans.
0👍
I got the same error below:
OSError: No translation files found for default language hello.
When I set hello
to LANGUAGE_CODE and LANGUAGES in settings.py
as shown below. *I’m learning Translation with Django 4.2.1:
# "settings.py"
LANGUAGE_CODE = 'hello'
from django.utils.translation import gettext_lazy as _
LANGUAGES = (
('hello', _('Hello')),
)
So, I ran makemessages below but I couldn’t solve the error:
django-admin makemessages -l hello
So, I ran compilemessages below, then I could solve the error:
django-admin compilemessages
But, I got another error below and I could not solve the error with several solutions:
ValueError: invalid token in plural form: EXPRESSION
Finally, I found the answer below saying:
You should use LANGUAGE_CODE exactly as mentioned in LANGUAGES list
located indjango/conf/global_settings.py
So, I should set the languages listed in LANGUAGES
in django/conf/global_settings.py to LANGUAGE_CODE
and LANGUAGES
in settings.py
.
- [Django]-Getting date from Django datetime field with F() expression
- [Django]-Django auto_now behaviour