views:

11

answers:

2

I'm rendering a template with a management command (something I need for producing documentation in my native language). So I've no request object, so no RequestContext. Is there a way I can force the template rendering process to lookup translation strings from a particular language other than English?

A: 

You could try setting settings.LANGUAGE_CODE directly in your management command.

Daniel Roseman
No I didn't, but activating the translation for the language worked.
Vasil
A: 

In case someone else needs something like this. You need to do the following before rendering the template:

from django.utils import translation
translation.activate(cur_language)

where cur_language is the language code for the language you want.

Vasil