Denigma
• October 5, 2012 • ⏱️ 1 min read • 38 words
#coding #django #note #translation

Sending Translated Messages

Define a field for holding the language of a user and a get_lang_for_user function, than just: ::

from django.utils import translation

cur_language = translation.get_language()
translation.activate(get_lang_for user(user)) 
# send email, tweet, etc
translation.activate(cur_language)
100%