src/cm/utils/i18n.py
author gibus
Thu, 09 Aug 2012 13:05:11 +0200
changeset 458 ba7e05582435
parent 0 40c8f766c9b8
permissions -rw-r--r--
When extracting body of a document in HTML source format (i.e. without pandoc conversion before display), use BeautifilSoup, which is more tolerant, instead of xml.dom.minidom, which crashes too often.

from django.utils.translation.trans_real import translation

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