Thanks. I am using LocaleMiddleware. I changed my languages to:
LANGUAGE_CODE = 'en-gb'
USE_I18N = True
LANGUAGES = (
('en-gb', ugettext('English')),
('de', ugettext('German')),
('fr', ugettext('French'))
)
But I'm still getting en-us.
On Wednesday, 18 June 2014 13:29:45 UTC-4, Ilya Kazakevich wrote:
>
> 1) Try to debug your code. Django is open source and sources are
> available:)
> 2) Do you have LocaleMiddleware installed?
> 3) Do not use bare language, use language-region (
> http://www.i18nguy.com/unicode/language-identifiers.html) : en-gb, en-us,
> en-bb and so on
> 4) It is generally bad idea to depend on LANGUAGE_CODE. You should use
> get_language() to support I18N
>
> Ilya Kazakevich,
> JetBrains PyCharm (Best Python/Django IDE)
> http://www.jetbrains.com/pycharm/
> "Develop with pleasure!"
>
>
> >-----Original Message-----
> >From: [email protected] <javascript:>
> >[mailto:[email protected] <javascript:>] On Behalf Of Stodge
> >Sent: Wednesday, June 18, 2014 9:21 PM
> >To: [email protected] <javascript:>
> >Subject: Re: Language code issue - Django thinks default is en-us?
> >
> >Even when I override the language code in my custom command
> get_language()
> >still returns "en-us". Weird. Guess I'll have to use
> settings.LANGUAGE_CODE
> >instead of get_language().
> >
> >On Wednesday, 18 June 2014 13:02:37 UTC-4, Stodge wrote:
> >
> > Oh.
> >
> > https://docs.djangoproject.com/en/dev/howto/custom-management-com
> >mands/#management-commands-and-locales
> ><https://docs.djangoproject.com/en/dev/howto/custom-management-comman
> >ds/#management-commands-and-locales>
> >
> > I forgot to mention that the signal is executed as a result of a
> loaddata
> >management command. So management commands don't respect
> >settings.LANGUAGE_CODE? That makes no sense.
> >
> > On Wednesday, 18 June 2014 12:48:47 UTC-4, Stodge wrote:
> >
> > My settings for languages are:
> >
> >
> > LANGUAGE_CODE = 'en'
> >
> >
> > USE_I18N = True
> > LANGUAGE_COOKIE_NAME='django_language'
> > ugettext = lambda s: s
> > LANGUAGES = (
> > ('en', ugettext('English')),
> > ('de', ugettext('German')),
> > ('fr', ugettext('French'))
> > )
> >
> >
> > I have a post-save signal that creates instances of a
> model and gets the
> >current Django language. The language returned is for some reason
> "en-us", but
> >I have no idea where this is coming from. My default as shown above is
> "en".
> >get_language() is called from within a signal so the language isn't being
> taken
> >from a cookie or request header. Any ideas why Django thinks the current
> >(default) language is "en-us"? Thanks
> >
> >
> >--
> >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
> >[email protected] <javascript:>.
> >To post to this group, send email to [email protected]
> <javascript:>.
> >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/d5dcf509-a634-4f46-940c-8e0
> >ee6c0ee69%40googlegroups.com
> ><
> https://groups.google.com/d/msgid/django-users/d5dcf509-a634-4f46-940c-8e
> >0ee6c0ee69%40googlegroups.com?utm_medium=email&utm_source=footer> .
> >For more options, visit https://groups.google.com/d/optout.
>
>
>
--
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 [email protected].
To post to this group, send email to [email protected].
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/aec80a5b-3c00-449c-b4f2-351d6a0b8816%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.