Wednesday, September 23, 2015

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

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

Il giorno mercoledì 23 settembre 2015 14:23:38 UTC+2, PyMan ha scritto:
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

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@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.

No comments:

Post a Comment