On Wednesday 22 January 2014 18:58:26 Henrique Romano wrote:
> On Wed, Jan 22, 2014 at 2:38 PM, Shai Berger <[email protected]> wrote:
> > I don't think Django should take responsibility for a 3rd-party package
> > which
> > decides that some part of a setting should be translatable whether the
> > user said so or not.
> >
> > You might want to take this up with django-cms.
>
> Not exactly true. Even though my problem was with django-cms, if you grep
> django source code for "LANGUAGES" you will find this templatetag:
>
> # templatetags/i18n.py
> 15 class GetAvailableLanguagesNode(Node):
> 16 def __init__(self, variable):
> 17 self.variable = variable
> 18
> 19 def render(self, context):
> 20 from django.conf import settings
> 21 context[self.variable] = [(k, translation.ugettext(v)) for k, v
> in settings.LANGUAGES]
> 22 return ''
>
> It is also translating the given language name.
You are right. Further, the documentation[1] specifically says that language
names get translated, whether or not you use this tag.
> My suggestion is to
> update the documentation saying that the developer should use ugettext_lazy
> for the language name if they want it translated *or* at least use a
> unicode string.
That's not accurate -- the documentation should say that language names get
translated whether or not you use ugettext_lazy, if you use RequestContext or
the i18n tags, and *recommend* that anything you put there be either
translated with ugettext_lazy or be a unicode ubject. It is still valid to use
a non-unicode string if:
1) The value is all ASCII
2) The value has translations in all used languages.
(you saw the error because your language name does not have a translation, and
thus was used as given instead).
Bugs and patches welcome,
Shai.
[1] https://docs.djangoproject.com/en/dev/topics/i18n/translation/#other-tags
--
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/201401221915.45177.shai%40platonix.com.
For more options, visit https://groups.google.com/groups/opt_out.