Altering settings.LANGUAGE_CODE at runtime switches languages
dynamically (while the django manual says not to i.e. "You shouldn’t
alter settings in your applications at runtime")
e.g. english for .com and pt_BR for .com.br:
from django.conf import settings
if os.environ.get('HTTP_HOST'):
url = os.environ['HTTP_HOST']
else:
url = os.environ['SERVER_NAME']
if url.endswith('domain1.com'):
settings.LANGUAGE_CODE = 'en'
elif url.endswith('domain2.com.br'):
settings.LANGUAGE_CODE = 'pt_BR'
Manual pages say "don't do this." The app does however dynamically
choose between english and portuguese depending on the URL this way. I
don't know why the manual advises against. Maybe performance reasons.
best regards
Niklas
On 31 Okt, 01:57, Ary Manzana <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Thanks all for the big effort you are putting in getting i18n into
> GAE.
>
> Did anyone find a way to choose a language dynamically?
>
> All the best,
> Ary
>
> On 23 oct, 22:03, Alexander Orlov <[EMAIL PROTECTED]> wrote:
>
> > On Oct 20, 10:00 am, A.TNG <[EMAIL PROTECTED]> wrote:
>
> > > Do you have any idea? I meet some similar problems in my project too.
>
> > I have investigated this issue and put a lot of time (too much!)
> > tinkering to get it working but without success (found a really dirty
> > hack to get it working with dev_appserver.py *locally*). However I
> > have killed this task in my project to be able to go on with other
> > tasks.
>
> > I will post a corresponding solution here if I find a way for setting
> > LANGUAGE_CODE *dynamically*. Maybe this issue is also unsolvable
> > without a hack in GAE API version v.1... Looking forward for GAE API v.
> > 2 :)
>
> > Best Regards
> > Alex
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---