Django 1.8 - It translates or it falls back when it should'nt...

29 views
Skip to first unread message

PyMan

unread,
Sep 23, 2015, 8:23:38 AM9/23/15
to Django users
Hi,
 I'm using django 1.8.4 with these settings

LANGUAGE_CODE = 'en'

ugettext
= lambda s: s

LANGUAGES
= (
   
('it', ugettext('LANG_ITALIANO')),
   
('en', ugettext('LANG_INGLESE')),
)

LOCALE_PATHS
= (
               
'C:/path1/locale',
               
'C:/path2/locale',
               
)

In both path1 and path2 I have "en/LC_MESSAGES/django.po/mo" and "it/LC_MESSAGES/django.po/mo" where all the "msgid" defined in english are also defined in italian (created by "makemessages") and all of them have their "msgstr" compiled with some value (with PO edit and/or manually edited), then compiled with "compilemessages".

For example I have in "en/LC_MESSAGES/django.po"
msgid "TIPO_DOCUMENTO"
msgstr "Document type"

and in "it/LC_MESSAGES/django.po"
msgid "TIPO_DOCUMENTO"
msgstr "Tipo documento"

When using the site in english, the base language, all terms are correctly in english, instead when I change the language via django.views.i18n.set_language something really weird happens: some of the terms (NOT EVERYONE) are not translated, and since django 1.8 introduced fallback system about translations (https://code.djangoproject.com/ticket/24739) I get the english msgstr for "TIPO DOCUMENTO" that is "Document type".

I have some other locale folders in some used django-apps, anyway none of them contains that "msgid". The same is for the ones that are correctly translated.

Anyway if I set the base language to "it", it happens the same problem for english when surfing in english.

Why????
Thank you

PyMan

unread,
Sep 23, 2015, 11:20:52 AM9/23/15
to Django users
Oh shame on me! I had this problem may years ago.....here I go with the ugettext_lazy.... http://stackoverflow.com/questions/2694798/django-form-and-i18n/2694847#2694847

Luis Zárate

unread,
Sep 23, 2015, 11:55:41 AM9/23/15
to django...@googlegroups.com
I had the same problem with 1.8, l solved editing with external program called poedit. I don't know why django build wrong po file, but when compile the translation is not complete.
> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
> To post to this group, send email to django...@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/6d0945d6-e284-481d-b356-a5a508e9d34a%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

--
"La utopía sirve para caminar" Fernando Birri



Reply all
Reply to author
Forward
0 new messages