On Wednesday 22 January 2014 18:01:14 Henrique Romano wrote:
> On Wed, Jan 22, 2014 at 12:39 PM, Shai Berger <[email protected]> wrote:
> > This has nothing to do with the LANGUAGES setting, or the string being a
> > language name. it just so happens that ugettext tries to return unicode,
> > and
> > so for an untranslated string s it returns unicode(s). You can get the
> > same error by writing
> > 
> >         unicode("Português")
> 
> Correct.
> 
> > You should make sure that every string you pass to unicode(), directly or
> > indirectly, is either a unicode object or an ASCII-only string (except in
> > cases where you also pass the encoding); but that is general Python, not
> > Django-specific.
> 
> The point is that I didn't know I had to pass an unicode string, I didn't
> even know about the internals (of django-cms or django, I don't remember)
> where the language name is being translated and therefore an unicode string
> was necessary.  That's what I'm suggesting here, to make it explicit that
> the language name string must be a unicode string.

Wait -- so the real context (which, as Ramiro noted, you left out) is

# settings.py

LANGUAGES = (('pt_BR', _("Português")),)

Is it? Or is it

LANGUAGES = (('pt_BR', "Português"),)

If it is the former, then this is a generic issue of translatable strings -- 
nothing to do with settings.LANGUAGES. It is usually assumed that, if you are 
making a string translatable, you write it in English -- then it's ASCII and 
all's well.

If it is the latter, please provide more details about the specific error you 
encountered (stack traces etc).

Shai.

-- 
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/201401221816.59089.shai%40platonix.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to