Skip to content

Commit

Permalink
[FIX] base: generate translations in po format
Browse files Browse the repository at this point in the history
Instead of csv, it allows to benefit from some features of POFile class like
handeling the duplicated terms correctly

In odoo#26553, generating the missing terms was creating a new translation for
base.xml with no translation (value=src), making a previously translated term
no longer translated.

Closes odoo#26614
Fixes odoo#26553
  • Loading branch information
mart-e committed Aug 28, 2018
1 parent 9e6e0da commit fe9cd11
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions odoo/addons/base/module/wizard/base_update_translations.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.

import contextlib
import io
import tempfile

from odoo import api, fields, models, tools, _
from odoo.exceptions import UserError
Expand Down Expand Up @@ -30,7 +29,7 @@ def _get_lang_name(self, lang_code):
def act_update(self):
this = self[0]
lang_name = self._get_lang_name(this.lang)
with contextlib.closing(io.BytesIO()) as buf:
tools.trans_export(this.lang, ['all'], buf, 'csv', self._cr)
tools.trans_load_data(self._cr, buf, 'csv', this.lang, lang_name=lang_name)
with tempfile.NamedTemporaryFile() as buf:
tools.trans_export(this.lang, ['all'], buf, 'po', self._cr)
tools.trans_load_data(self._cr, buf, 'po', this.lang, lang_name=lang_name)
return {'type': 'ir.actions.act_window_close'}

0 comments on commit fe9cd11

Please sign in to comment.