user43506
user43506

Reputation: 165

Django makemessages duplicates translation

I have existing .po file, But I am still building my project so new translation strings are added and some of already added one are changing places.

To update my .po file I am running

django-admin makemessages -l en

When I open the file I see that the same translation is duplicated many times:

#: _templates/admin-users/base/partials/sidebar.html:38
msgid "main-nav-guests"
msgstr "Guests"


#: _templates/admin-users/base/partials/sidebar.html:58
#, fuzzy
#| msgid "main-nav-guests"
msgid "main-nav-event-settings"
msgstr "Guests"

#: _templates/admin-users/base/partials/sidebar.html:101
#, fuzzy
#| msgid "main-nav-guests"
msgid "main-nav-events"
msgstr "Guests"

#: _templates/admin-users/base/partials/sidebar.html:106
#, fuzzy
#| msgid "main-nav-guests"
msgid "main-nav-account-settings"
msgstr "Guests"

My Django Version is 1.9.5

How can I fix that ? Thank you :)

Upvotes: 1

Views: 1702

Answers (1)

user2390182
user2390182

Reputation: 73460

makemessages always tries to be smart. If you already have a translation for 'main-nav-guests' (on a side note, what are you translating here: English-English?) and add other messages that resemble that msgid, they will receive the same msgstr as the existing one, but be marked with those fuzzy comments:

#, fuzzy
#| msgid "main-nav-guests"

that indicate that this is a) auto-generated by fuzzy msgid-matching and b) it used the translation of the "main-nav-guests" msgid.

What I usually do after each makemessages, is to search the django.po for empty msgstr and 'fuzzy' translations. Then I fill the empty and correct the fuzzy ones if necessary which includes removing the two comment lines from above. Then, everything should be ready to go.

Adding some sort of --no-fuzzy option for makemessages was suggested and declined.

Upvotes: 1

Related Questions