On Mon, 2008-12-22 at 05:06 -0800, Iwan wrote:
> Hi there,
> 
> We're using Django templates on their own.  Usually invoked like this
> (eg):
> 
> -----------------------------------------------------
> t = django.template.Template(templateSource)
> c = django.template.Context({})
> 
> print t.render(c)
> -----------------------------------------------------
> 
> When you add i18n to this mix, however, how do you set the language to
> be used when rendering?  Can you put something into the context?

You can do it this way:

        from django.utils import translation
        
        translation.activate(locale)
        
where "locale" is a variable containing the name of the locale you wish
to activate. You should call that as early as possible in the processing
pipeline once you know the right locale value.

Regards,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" 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/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to