def _process_text(self, txt):
 if (not self.localcontext):
  return str2xml(txt)
 if (not txt):
  return ''
 result = ''
 sps = _regex.split(txt)
 while sps:
  to_translate = tools.ustr(sps.pop(0))
  result += tools.ustr(self.localcontext.get('translate', (lambda x: x))(to_translate))
  if sps:
   txt = None
   try:
    expr = sps.pop(0)
    txt = safe_eval(expr, self.localcontext)
    if (txt and isinstance(txt, basestring)):
     txt = tools.ustr(txt)
   except Exception:
    _logger.info('Failed to evaluate expression [[ %s ]] with context %r while rendering report, ignored.', expr, self.localcontext)
   if isinstance(txt, basestring):
    result += txt
   elif (txt and (txt is not None) and (txt is not False)):
    result += ustr(txt)
 return str2xml(result)

def _process_text ( self , txt ) : if ( not self . localcontext ) : return str2xml ( txt ) if ( not txt ) : return '' result = '' sps = _regex . split ( txt ) while sps : to_translate = tools . ustr ( sps . pop ( 0 ) ) result += tools . ustr ( self . localcontext . get ( 'translate' , ( lambda x : x ) ) ( to_translate ) ) if sps : txt = None try : expr = sps . pop ( 0 ) txt = safe_eval ( expr , self . localcontext ) if ( txt and isinstance ( txt , basestring ) ) : txt = tools . ustr ( txt ) except Exception : _logger . info ( 'Failed to evaluate expression [[ %s ]] with context %r while rendering report, ignored.' , expr , self . localcontext ) if isinstance ( txt , basestring ) : result += txt elif ( txt and ( txt is not None ) and ( txt is not False ) ) : result += ustr ( txt ) return str2xml ( result )
translate txt according to the language in the local context .