23👍
did you try :
python manage.py makemessages -a
from project root and app ?
this should create a .po that you have to edit.
be sure to remove ‘fuzzy’ stuff everywhere.
then :
python manage.py compilemessages
You need to restart the server
1👍
For newer versions of Django (e.g. 3.2):
-
in the root directory create folder "locale"
-
run command
django-admin makemessages -l ru
-
update your language files (located in the locale folder)
-
run
django-admin compilemessages
-
Configure the LOCALE_PATHS in settings.py, otherwise you won’t see the translations:
LOCALE_PATHS = [os.path.join(BASE_DIR, 'locale')]
LANGUAGE_CODE = 'ru'
- Django query how to write: WHERE field LIKE '10__8__0__'?
- Django limit_choices_to on user group
- Django Celery Task Logging
- Django – links generated with {% url %} – how to make them secure?
- Django QuerySet object has no attribute 'objects
0👍
To fix empty po files:
- Make sure you did the needed changes for the templates as mentioned in the documentation. Please make sure that you are checking the correct documentation version for your project.
- You can add a
locale
directory in yourtemplates
directory and add its path to theLOCALE_PATHS
list. (Optional, but helpful to make sure that the template directory is included in step 4) - Go to the project_dir (you should run the next command in a parent directory of the files to be translated)
- Run the command
django-admin makemessages -l ru
- Django Admin, accessing reverse many to many
- How do I update an object's members using a dict?
- Unsupported lookup 'istartwith' for CharField or join on the field not permitted
- Is it possible to stop Django from creating .pyc files, whilst in development?
- Django REST Framework different depth for POST/PUT?
Source:stackexchange.com