[IMP] Translations of static terms in views
bzr revid: fp@tinyerp.com-20120628141632-ghixqjf59jodqgx4
This commit is contained in:
@@ -1737,6 +1737,15 @@ class BaseModel(object):
|
||||
|
||||
# translate view
|
||||
if 'lang' in context:
|
||||
if node.text and node.text.strip():
|
||||
trans = self.pool.get('ir.translation')._get_source(cr, user, self._name, 'view', context['lang'], node.text.strip())
|
||||
if trans:
|
||||
node.text = trans
|
||||
if node.tail and node.tail.strip():
|
||||
trans = self.pool.get('ir.translation')._get_source(cr, user, self._name, 'view', context['lang'], node.tail.strip())
|
||||
if trans:
|
||||
node.tail = trans
|
||||
|
||||
if node.get('string') and not result:
|
||||
trans = self.pool.get('ir.translation')._get_source(cr, user, self._name, 'view', context['lang'], node.get('string'))
|
||||
if trans == node.get('string') and ('base_model_name' in context):
|
||||
|
||||
@@ -501,6 +501,10 @@ def trans_parse_rml(de):
|
||||
|
||||
def trans_parse_view(de):
|
||||
res = []
|
||||
if de.text and de.text.strip():
|
||||
res.append(de.text.strip().encode("utf8"))
|
||||
if de.tail and de.tail.strip():
|
||||
res.append(de.tail.strip().encode("utf8"))
|
||||
if de.tag == 'attribute' and de.get("name") == 'string':
|
||||
if de.text:
|
||||
res.append(de.text.encode("utf8"))
|
||||
|
||||
Reference in New Issue
Block a user