summaryrefslogtreecommitdiff
path: root/addons/transifex/models
diff options
context:
space:
mode:
authorGoffin Simon <sig@odoo.com>2021-01-27 15:51:10 +0000
committerGoffin Simon <sig@odoo.com>2021-01-30 14:51:19 +0000
commitd609a75ccbfaa62b6070de4769880a94d896ff73 (patch)
tree3ae435559f45f5870675b31ebc1c0482684562a7 /addons/transifex/models
parent827f65f70634ba7a2e4175f20e5301e514ada0a0 (diff)
[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) <sig@openerp.com> Co-authored-by: mart-e <mat@odoo.com>
Diffstat (limited to 'addons/transifex/models')
-rw-r--r--addons/transifex/models/ir_translation.py10
1 files changed, 5 insertions, 5 deletions
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}",
}