On Nov 19 2008, 7:20 am, niklasr <[email protected]> wrote:
> 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'

An even cleaner solution would be to use the "Accept-Language" header
value which you can get by calling the following command:

self.request.headers.get('Accept-Language')

It retrieves the users preferred language specified in the browser
settings. The returned value can be also a prioritized list of
languages like:

en_US,en,de,ru
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to