From d46ff405bf5530a6d3f361a520d6aa238c77a08b Mon Sep 17 00:00:00 2001 From: Bruno Alla Date: Wed, 31 May 2023 20:28:37 +0100 Subject: [PATCH] Update instructions for Docker --- {{cookiecutter.project_slug}}/locale/README.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/{{cookiecutter.project_slug}}/locale/README.rst b/{{cookiecutter.project_slug}}/locale/README.rst index 4a7533107..b46feb1c2 100644 --- a/{{cookiecutter.project_slug}}/locale/README.rst +++ b/{{cookiecutter.project_slug}}/locale/README.rst @@ -3,7 +3,7 @@ Translations Translations strings will be placed in this folder when running:: - python manage.py makemessages -all + {% if cookiecutter.use_docker == 'y' %}docker-compose -f local.yml run --rm django {% endif %}python manage.py makemessages -all --no-location This should generate ``django.po`` (stands for Portable Object) files under each locale `/LC_MESSAGES/django.po`. Each translatable string in the codebase is collected with its ``msgid`` and need to be translated as ``msgstr``, for example:: @@ -12,6 +12,8 @@ This should generate ``django.po`` (stands for Portable Object) files under each Once all translations are done, they need to be compiled into ``.mo`` files (stands for Machine Object), which are the actual binary files used by the application:: - python manage.py compilemessages + {% if cookiecutter.use_docker == 'y' %}docker-compose -f local.yml run --rm django {% endif %}python manage.py compilemessages Note that the ``.po`` files are NOT used by the application directly, so if the ``.mo`` files are out of dates, the content won't appear as translated even if the ``.po`` files are up to date. + +The production image runs ``compilemessages`` automatically at build time, so as long as your translated source files (PO) are up to date, you're good to go.