Django how to not comment some lines with makemessages

414 views Asked by At

Problem

I translate my group names in my Django application with the default translation tools.

Since my group names are not hard-coded in my code, when I run makemessages, the lines corresponding to my group names are commented out.

Example

I have a group named management_product which is automatically created during migrations. I put these lines in django.po:

msgid "management_product"
msgstr "Gestion des produits"

But if I run django-admin makemessages -l fr, they are commented out:

#~ msgid "management_product"
#~ msgstr "Gestion des produits"

Question

How can I disable this behaviour?

1

There are 1 answers

0
Işık Kaplan On BEST ANSWER

Django translations are not meant for dynamic data translations that come from third party data sources like your db. It is meant to translate the static stuff you have in your codebase.

You may want to use something like: https://django-modeltranslation.readthedocs.io/en/latest/ instead.