Confirm message support translation and export

bzr revid: ysa@tinyerp.com-20101124093647-hbh2gzghkf39desi
This commit is contained in:
Margarita Manterola 2010-11-24 15:06:47 +05:30 committed by Yogesh Sakhreliya
parent 8940877f64
commit b140c3cacb
2 changed files with 10 additions and 2 deletions

View File

@ -1386,6 +1386,12 @@ class orm_template(object):
trans = self.pool.get('ir.translation')._get_source(cr, user, context['base_model_name'], 'view', context['lang'], node.get('string'))
if trans:
node.set('string', trans)
if node.get('confirm'):
trans = self.pool.get('ir.translation')._get_source(cr, user, self._name, 'view', context['lang'], node.get('confirm').encode('utf8'))
if not trans and ('base_model_name' in context):
trans = self.pool.get('ir.translation')._get_source(cr, user, context['base_model_name'], 'view', context['lang'], node.get('confirm').encode('utf8'))
if trans:
node.set('confirm', trans)
if node.get('sum'):
trans = self.pool.get('ir.translation')._get_source(cr, user, self._name, 'view', context['lang'], node.get('sum'))
if trans:

View File

@ -166,7 +166,7 @@ class GettextAlias(object):
cr = pooler.get_db(dbs[0]).cursor()
is_new_cr = True
return cr, is_new_cr
def _get_lang(self, frame):
lang = frame.f_locals.get('context', {}).get('lang', False)
if not lang:
@ -178,7 +178,7 @@ class GettextAlias(object):
c = getattr(s, 'localcontext', {})
lang = c.get('lang', False)
return lang
def __call__(self, source):
is_new_cr = False
res = source
@ -464,6 +464,8 @@ def trans_parse_view(de):
res.append(de.get('string').encode("utf8"))
if de.get("sum"):
res.append(de.get('sum').encode("utf8"))
if de.get("confirm"):
res.append(de.get('confirm').encode("utf8"))
for n in de:
res.extend(trans_parse_view(n))
return res