diff options
| author | Victor Feyens <vfe@odoo.com> | 2020-07-22 16:52:13 +0000 |
|---|---|---|
| committer | Victor Feyens <vfe@odoo.com> | 2020-07-23 12:13:19 +0000 |
| commit | e8893f84abcc50dfdfd3173497f388e94310f090 (patch) | |
| tree | e33136b3d2dee7bffebdc2be743f4f6a15099407 /addons/product | |
| parent | b932ea75fec28052d8bc262c590171dfa97ef4e9 (diff) | |
[IMP] *: translations improvements
Avoid concatenation of translated strings & raw values and/or other
translated values, and use the new _ API (by providing the formatting
values to ensure the fallback on the english terms in case of wrong
translation).
By including the expected values inside the string to translate, we
ensure that the formatted values are included at the right place in the
resulting translated text.
This also provides more information on the string to translate to
the translators, s.t. the chosen terms for the translations can be more
adapted to the translation context.
closes odoo/odoo#54635
Related: odoo/enterprise#11925
Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
Diffstat (limited to 'addons/product')
| -rw-r--r-- | addons/product/models/product.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/addons/product/models/product.py b/addons/product/models/product.py index 3661ee7fe97..c11fa3aac44 100644 --- a/addons/product/models/product.py +++ b/addons/product/models/product.py @@ -548,10 +548,12 @@ class ProductProduct(models.Model): @api.model def view_header_get(self, view_id, view_type): - res = super(ProductProduct, self).view_header_get(view_id, view_type) if self._context.get('categ_id'): - return _('Products: ') + self.env['product.category'].browse(self._context['categ_id']).name - return res + return _( + 'Products: %(category)s', + category=self.env['product.category'].browse(self.env.context['categ_id']).name, + ) + return super().view_header_get(view_id, view_type) def open_pricelist_rules(self): self.ensure_one() |
