[Solved]-Django doesn't create translation .po files

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

👤jujule

1👍

For newer versions of Django (e.g. 3.2):

  1. in the root directory create folder "locale"

  2. run command django-admin makemessages -l ru

  3. update your language files (located in the locale folder)

  4. run django-admin compilemessages

  5. 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'

0👍

To fix empty po files:

  1. 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.
  2. You can add a locale directory in your templates directory and add its path to the LOCALE_PATHS list. (Optional, but helpful to make sure that the template directory is included in step 4)
  3. Go to the project_dir (you should run the next command in a parent directory of the files to be translated)
  4. Run the command django-admin makemessages -l ru

Leave a comment