src/cm/utils/i18n.py
author gibus
Fri, 13 Apr 2012 11:53:42 +0200
changeset 407 2d14a80716e2
parent 0 40c8f766c9b8
permissions -rw-r--r--
When last_version is deleted, do not delete text and previous versions in cascade, but really delete text only when there is no previous version, otherwise update text.last_version with previous version.

from django.utils.translation.trans_real import translation

def translate_to(value, language_code):
    t = translation(language_code)    
    return getattr(t, 'gettext')(value)