On Wed, Feb 24, 2010 at 8:59 PM, Tor Nordam <tor.nor...@gmail.com> wrote:
> Thank you for your reply,
>
> Using the {% trans %} method is indeed what I intend to do. But the
> problem is how to set the language on a page basis, rather than as an
> installation-wide setting, or a user-selectable setting.
>


Just do what django.middleware.locale.LocaleMiddleware does (Use the
source, Luke):

Activate the required language (django.utils.translation.activate).
Set request.LANGUAGE_CODE to the required language.
Set the header 'Content-Language' on the response.
If the page contents vary upon the requested language, set/update the
'Vary' header on the response to include 'Accept-Language', but sounds
as though your pages are in one specific language.
Deactivate the translation after you're done with it.

Cheers

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to