Sending Translated Messages

Created on Oct. 5, 2012, 3:42 p.m. by Hevok & updated by Hevok on May 2, 2013, 5:26 p.m.

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)

Tags: translation, coding, django, note
Parent: Web Framework

Update entry (Admin) | See changes

Comment on This Data Unit