← Back to team overview

openerp-community-reviewer team mailing list archive

[Merge] lp:~savoirfairelinux-openerp/ocb-server/translate_warnings_1297525-trunk into lp:ocb-server

 

Sandy Carter (http://www.savoirfairelinux.com) has proposed merging lp:~savoirfairelinux-openerp/ocb-server/translate_warnings_1297525-trunk into lp:ocb-server.

Requested reviews:
  OpenERP Community Backports Team (ocb)
Related bugs:
  Bug #1297525 in OpenERP Web: "Title of except_orm "Warning" is untranslatable"
  https://bugs.launchpad.net/openerp-web/+bug/1297525

For more details, see:
https://code.launchpad.net/~savoirfairelinux-openerp/ocb-server/translate_warnings_1297525-trunk/+merge/212736

When searching a frame for context, the _() looks for self.localcontext but misses self.context.
The integration of this patch allows for web warnings (such as except_orm) to be translated by _()
-- 
https://code.launchpad.net/~savoirfairelinux-openerp/ocb-server/translate_warnings_1297525-trunk/+merge/212736
Your team OpenERP Community Backports Team is requested to review the proposed merge of lp:~savoirfairelinux-openerp/ocb-server/translate_warnings_1297525-trunk into lp:ocb-server.
=== modified file 'openerp/tools/translate.py'
--- openerp/tools/translate.py	2014-03-17 08:06:23 +0000
+++ openerp/tools/translate.py	2014-03-25 22:24:41 +0000
@@ -196,7 +196,7 @@
             lang = ctx.get('lang')
         s = frame.f_locals.get('self', {})
         if not lang:
-            c = getattr(s, 'localcontext', None)
+            c = getattr(s, 'localcontext', None) or getattr(s, 'context', None)
             if c:
                 lang = c.get('lang')
         if not lang:


Follow ups