[FIX] report_webkit: translations lookup should ignore report name for webkit reports
authorOlivier Dony <odo@openerp.com>
Thu, 19 Jan 2012 10:21:45 +0000 (11:21 +0100)
committerOlivier Dony <odo@openerp.com>
Thu, 19 Jan 2012 10:21:45 +0000 (11:21 +0100)
Webkit/Mako translations are quite different from RML
report translations, and very similar to translations
for Python code terms, i.e. with _(). The method to
lookup the translations at rendering time should thus
be similar to what _() does for Python code terms, and
not depend on the name of the report, which is not
known when exporting the translation template, and is
therefore not available in POT meta-data.
This bears no performance penalty, as we are still
only looking inside 'report'-typed translations with
the matching 'source term'.
The only downside is that this prevents per-report
translations, but this is not supported by our
translation import/export system anyway, so it
does not matter (msgid strings must be unique
within a PO file, and we don't support context-
sensitive PO files yet).

lp bug: https://launchpad.net/bugs/819334 fixed

bzr revid: odo@openerp.com-20120119102145-tp3w80bhjwq11q84

addons/report_webkit/webkit_report.py

index 9d0b663..d3057e5 100644 (file)
@@ -182,7 +182,7 @@ class WebKitParser(report_sxw):
         """Translate String."""
         ir_translation = self.pool.get('ir.translation')
         res = ir_translation._get_source(self.parser_instance.cr, self.parser_instance.uid,
-                                         self.name, 'report', self.parser_instance.localcontext.get('lang', 'en_US'), src)
+                                         None, 'report', self.parser_instance.localcontext.get('lang', 'en_US'), src)
         if not res :
             return src
         return res