Django change fuzzy threshold while running makemessages

21 views Asked by At

When Im running

python manage.py makemessages

I have fuzzy lines in my django.po file, for example :

#, fuzzy
#| msgid "Last Month"
msgid "Last Year"
msgstr "Dernier mois"

This is due to the gettext.merge command used by django as explained here : https://hexdocs.pm/gettext/Mix.Tasks.Gettext.Merge.html#module-options

To solve this issue, I should use the --no-fuzzy tag or reduce the --fuzzy-threshold. But my issue is that there is no way to do that using django makemessages command (at least I can't find it)

Is there a workaround I can use to fix my problem please?

1

There are 1 answers

0
Sabrebar On

I found how to do this, create a custom command custom_makemessages.py inside the myproject/management/commands folder, copy paste the original makemessages command source code (can be found here https://github.com/django/django/blob/main/django/core/management/commands/makemessages.py) and change the msgmerge_options variable to add the option you want.

Then run python manage.py custom_makemessages command with the regular parameters