django makemessages management command

100 views
Skip to first unread message

Osama AbuOmar

unread,
Sep 24, 2018, 7:49:08 AM9/24/18
to Django developers (Contributions to Django itself)
About the django makemessages management command. I think there should by an option to NOT let django comment out manually added translations to the .po files.
sometimes I need to manually add a translation definition (msgid, msgstr), these are not in any of my template or python files. and when I run makemessages they get commented out. and this is an issue.
thanks 

Claude Paroz

unread,
Sep 24, 2018, 8:14:24 AM9/24/18
to Django developers (Contributions to Django itself)
Hi Osama,

You can simply do that by including a gettext_noop('your custom string') line anywhere in your code (or in a specific file you create for that purpose).

Regards,

Claude

Marcin Nowak

unread,
Oct 3, 2018, 7:07:42 AM10/3/18
to Django developers (Contributions to Django itself)

You can simply do that by including a gettext_noop('your custom string') line anywhere in your code (or in a specific file you create for that purpose).


This is an ugly workaround.  Makemessages has other issue - it grabs messages from external eggs/packages, which are found in current and nested dirs. So beware - it can make a mess with your translations.

BR,
Marcin

vishvajit pathak

unread,
Oct 5, 2018, 7:23:38 AM10/5/18
to Django developers (Contributions to Django itself)
You could include the a python file where you can place all the strings which you manually wanted to add and then use the makemessages management command. I think it will serve the purpose. 

I think this behaviour of commenting out manually added strings by makemessages management command is correct.
Reply all
Reply to author
Forward
0 new messages