Hi,
As per the documentation[1], it is not clear that you _must_ use a unicode
string for the language name. If you don't use an unicode string, the
following can happen:
>>> from django.utils.translation import ugettext
>>> ugettext("Português")
Traceback (most recent call last):
...
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 7:
ordinal not in range(128)
As opposed to:
>>> ugettext(u"Português")
u'Portugu\xeas'
I was just having an issue where the languages available was being rendered
in the template, but since TEMPLATE_DEBUG was enabled, no errors was
generated in the development environment. Switching TEMPLATE_DEBUG off in
the production resulted in an exception with almost no clue on what
happened.
What do you guys think about making it clear that the user should always
use an unicode string for the LANGUAGES setting?
[1] https://docs.djangoproject.com/en/dev/ref/settings/#languages
--
Henrique Romano
--
You received this message because you are subscribed to the Google Groups
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-developers/CA%2BEHudKfPXxry6T2tW_6ZNFzJgAJUHs3nO_mLkdp3Xk2wS09xg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.