translation needs context but it doesn't always exist
Bug #724057 reported by
Albert Cervera i Areny - http://www.NaN-tic.com
This bug affects 4 people
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Server (MOVED TO GITHUB) |
Confirmed
|
Wishlist
|
OpenERP's Framework R&D |
Bug Description
OpenERP v6:
class GettextAlias in tools/translate.py requires a valid context available where _() was called. In some cases the context variable does not exsits or is not properly initialized. The attached patch provides a workarround by searching current user's language in order to find to which language it should translate.
The patch is based on a Jay Vora patch provided in a v5 bug report: https:/
Changed in openobject-server: | |
assignee: | nobody → OpenERP's Framework R&D (openerp-dev-framework) |
importance: | Undecided → Wishlist |
status: | New → Confirmed |
tags: | added: nan |
To post a comment you must log in.
On Thursday 24 February 2011, you wrote:
> Public bug reported:
>
> OpenERP v6:
>
> class GettextAlias in tools/translate.py requires a valid context
> available where _() was called. In some cases the context variable does
> not exsits or is not properly initialized. The attached patch provides a
> workarround by searching current user's language in order to find to
> which language it should translate.
>
I have 2 objections to that:
1. Speed. We want to avoid adding overhead to functions. The gettext one must
remain as light as possible (it is sometimes over-used, more than
appropriate).
2. Explicit/Implicit option to translate. In some cases, we explicitly don't bin/osv/ orm.py: 4052 where we
want to have a translation. So far, we have been doing that by not specifying
a 'lang' in the context. 1st example is the loading of a database and
'internal' operations. 2nd example is in server/
*must* avoid translation.
Please think twice before breaking this logic.