From d609a75ccbfaa62b6070de4769880a94d896ff73 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Wed, 27 Jan 2021 15:51:10 +0000 Subject: [FIX] transifex: Wrong link on translations to go to transifex Steps to reproduce the bug: - Let's consider a user U with fr_BE as lang - Log as U and active developper tool - Go on any record, click on debug button - Select Technical translation - Choose a translation and click on the transifex url button Bug: The URL contained the iso code fr_BE but this iso code didn't match any code in Transifex. From: https://www.transifex.com/odoo/odoo-14/languages/ We can see that the only iso codes with a '_' are: 'zh_CN', 'zh_TW', 'pt_BR' opw:2448533 closes odoo/odoo#65152 Signed-off-by: Simon Goffin (sig) Co-authored-by: mart-e --- addons/transifex/data/ir_translation_view.xml | 10 ++++++---- addons/transifex/i18n/transifex.pot | 5 +++++ addons/transifex/models/ir_translation.py | 10 +++++----- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/addons/transifex/data/ir_translation_view.xml b/addons/transifex/data/ir_translation_view.xml index bd6541b9567..13b79771134 100644 --- a/addons/transifex/data/ir_translation_view.xml +++ b/addons/transifex/data/ir_translation_view.xml @@ -5,9 +5,10 @@ ir.translation - + @@ -18,9 +19,10 @@ ir.translation - + diff --git a/addons/transifex/i18n/transifex.pot b/addons/transifex/i18n/transifex.pot index 8f55c29bdc4..3dceecf6793 100644 --- a/addons/transifex/i18n/transifex.pot +++ b/addons/transifex/i18n/transifex.pot @@ -30,6 +30,11 @@ msgstr "" msgid "Last Modified on" msgstr "" +#. module: transifex +#: model:ir.model.fields,help:transifex.field_ir_translation__transifex_url +msgid "Propose a modification in the official version of Odoo" +msgstr "" + #. module: transifex #: model_terms:ir.ui.view,arch_db:transifex.ir_translation_dialog_view_tree_transifex #: model_terms:ir.ui.view,arch_db:transifex.ir_translation_view_tree_transifex diff --git a/addons/transifex/models/ir_translation.py b/addons/transifex/models/ir_translation.py index 1f17fc47d3a..18a91ef082f 100644 --- a/addons/transifex/models/ir_translation.py +++ b/addons/transifex/models/ir_translation.py @@ -14,7 +14,7 @@ class IrTranslation(models.Model): _inherit = 'ir.translation' - transifex_url = fields.Char("Transifex URL", compute='_get_transifex_url') + transifex_url = fields.Char("Transifex URL", compute='_get_transifex_url', help="Propose a modification in the official version of Odoo") def _get_transifex_url(self): """ Construct transifex URL based on the module on configuration """ @@ -74,13 +74,13 @@ class IrTranslation(models.Model): translation.transifex_url = False continue - # e.g. https://www.transifex.com/odoo/odoo-10/translate/#fr/sale/42?q=text'Sale+Order' + # e.g. https://www.transifex.com/odoo/odoo-10/translate/#fr/sale/42?q=text:'Sale+Order' + src = werkzeug.urls.url_quote_plus(translation.src[:50].replace("\n", "").replace("'", "")) + src = f"'{src}'" if "+" in src else src translation.transifex_url = "%(url)s/%(project)s/translate/#%(lang)s/%(module)s/42?q=%(src)s" % { 'url': base_url, 'project': project, 'lang': lang_code, 'module': translation.module, - 'src': "text:'" + werkzeug.urls.url_quote_plus( - translation.src[:50].replace("\n", "").replace("'", "") - ) + "'", + 'src': f"text%3A{src}", } -- cgit v1.2.3