you can pass custom dictionnary to render_to_string
render_to_string(template_name, dictionary=None, context_instance=None)
The default context variable for LANGUAGES (see django / middlewares / context_processors.py):
context_extras['LANGUAGES'] = settings.LANGUAGES context_extras['LANGUAGE_CODE'] = translation.get_language() context_extras['LANGUAGE_BIDI'] = translation.get_language_bidi()
therefore, it may be sufficient to set LANGUAGE_CODE:
render_to_string('email-confirmation.html', {'LANGUAGE_CODE':'en'})
your template should look like this:
{% load i18n %} {% trans "Welcome to our new webapp" %}
Of course, you will be dealing with .po files, but you should be aware of this (unless you check this )
Hope this helps.
jujule
source share