Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Some strings not translated in django i18n module

I have some strange troubles with django's internationalization module. Most of strings are translated as they must be and some other aren't. Let me show you and example:

<li>{% trans "Upload Score" %}</li>
<li>{% trans "Profile" %}</li>
<li>{% trans "Invite friends" %}</li>
<li>{% trans "Settings" %}</li>

I have a list of 4 items for a menu. I run the django command makemessages to translate the site in french and I get everything as expected:

#: templates/main.html:190 templates/main.html.py:195
#, fuzzy
msgid "Upload Score"
msgstr "Publier"

#: templates/main.html:191 templates/main.html.py:196
msgid "Profile"
msgstr "Profil"

#: templates/main.html:192 templates/main.html.py:197
#, fuzzy
msgid "Invite Friends"
msgstr "inviter vos amis"

#: templates/main.html:193 templates/main.html.py:198
msgid "Settings"
msgstr "Préférences"

But when I compile it, will django-admin compilemessages, only "Profile" and "Settings" are translated. Do you know where it could come from? Could it be linked to the use of white spaces? Is there a debug mode in the i18n module?

Thanks for you help! :)

EDIT: We are on django 1.4.

like image 767
arthur Avatar asked Apr 02 '13 09:04

arthur


People also ask

How do I translate text in Django?

Use the function django. utils. translation. gettext_noop() to mark a string as a translation string without translating it.

What is fuzzy in Django po?

po files are updated with new translation strings, it is possible that some translation strings are automatically flagged as fuzzy. This happens when gettext finds some msgid that has been slightly modified. gettext pairs it with what it thinks was the old translation and flags it as fuzzy for review.

What is Gettext_lazy in Django?

gettext_lazy is a callable within the django. utils. translation module of the Django project.


1 Answers

You need to remove fuzzy lines.

Fuzzy probably means that the original string have been changed. Gettext don't want to lose your translations so it will change it but mark it fuzzy.

I recomend you rosetta. It will create you admin like interface where you can translate strings and manage fuzzy.

Cheers

like image 90
Vladislav Mitov Avatar answered Sep 27 '22 23:09

Vladislav Mitov