32
  1. Why sometimes I get a fuzzy item in django.po language file. Actually, I have checked in my project the fuzzy string item is totally unique.

    #: .\users\views.py:81 .\users\views.py:101
    #, fuzzy
    msgid "username or email"
    msgstr "9988"
    
  2. It is ok to be fuzzy but my translation of fuzzy item not showing up on the page, only English version shows up. It is totally odd.

perror
  • 7,071
  • 16
  • 58
  • 85
icn
  • 17,126
  • 39
  • 105
  • 141

3 Answers3

43

  1. msgmerge marks strings as fuzzy if the old catalog had a translation for a strings with a similar-looking msgid. It also carries over strings marked as fuzzy from an old catalog to a new one.

  2. msgfmt excludes fuzzy messages from the compiled catalog, as the translations are likely incorrect. The translator should check correctness of the translation (in the case you posted, an empty string is clearly an incorrect translation), and remove the fuzzy mark when the translation is is verified. If you absolutely want to use fuzzy translations, pass --use-fuzzy to msgfmt:

python manage.py compilemessages --use-fuzzy
Daniel W.
  • 31,164
  • 13
  • 93
  • 151
Martin v. Löwis
  • 124,830
  • 17
  • 198
  • 235
  • thanks, actually i put something at real translation say msgid "username or email" msgstr "9988" and i use 'django-admin.py compilemessages' command to compile , seems no --use-fuzzy parameter to pass. – icn Sep 04 '09 at 05:46
  • compilemessages just invokes `msgmft --check-format -o foo.mo foo.po` for all po files it finds. Just use msgfmt explicitly instead. – Martin v. Löwis Sep 04 '09 at 05:58
  • 1
    It is important to highlight that when you check that fuzzy translations are ok you should remove the fuzzy flag. Otherwise, they will be skipped with normal `compilemessages` calls – kiril Aug 29 '14 at 19:57
7

I also had these problems and I solved them all by using a 'po editor' (like poedit) which highlights fuzzy and untranslated entries and makes the translation process much faster.

You can also use Django Rosetta to have the translating process integrated in your Django environment.

Don
  • 16,928
  • 12
  • 63
  • 101
3

Very thanks to the 1st answer by @Martin v. Löwis.

Yes, that worked great. In my case, using --use-fuzzy switch was very useful.

In my case, the content of .po file lines (not working) was something like below. All translated lines were working except this.

#: ui/templates/theme/html/ltr/vertical-menu-template-nav-dark/login.html:58
#, fuzzy
#| msgid "Already a registered user (Login)"
msgid "Not a registered user (Create account)"
msgstr "Уже зарегистрированный пользователь (логин)"

Here is output of my terminal after executing django-admin compilemessages --use-fuzzy.

(venv3.6.7) Rishikeshs-MacBook-Air:src hygull$ django-admin compilemessages --use-fuzzy
processing file django.po in /Users/hygull/Projects/Python36/Django/Others/AMCProj/amc/src/locale/hi/LC_MESSAGES
processing file django.po in /Users/hygull/Projects/Python36/Django/Others/AMCProj/amc/src/locale/ru/LC_MESSAGES
processing file django.po in /Users/hygull/Projects/Python36/Django/Others/AMCProj/amc/src/locale/en/LC_MESSAGES

Finally, after running the command, just restart the server i.e. python manage.py runserver.

hygull
  • 8,464
  • 2
  • 43
  • 52