summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Trigaux <mat@odoo.com>2019-05-09 12:37:36 +0000
committerMartin Trigaux <mat@odoo.com>2019-05-09 12:55:04 +0000
commitde3a4c29476a34eb5db0c736124404113c03fd1a (patch)
treefd81a21954bacff1aad44debbd0caf0a62c36c5b
parenta515ee60647d6815459125540cf582150838c722 (diff)
[FIX] transifex: correctly escape links
This commit corrects two issues: - new lines characters are ignored by transifex when searching (searching on '\n' finds no match) - quotes are ignored by transifex (it used to be escaped with \\) - the text:'...' does not need to be escaped, it is the searched string that must be escaped. For instance, searching on "\n\nThis addon is already installed" used to give: https://www.transifex.com/odoo/odoo-12/translate/#fr/base/42?q=text%3A%27%0A%0AThis+addon+is+already+installed+on+your+system%27 and it now returns: https://www.transifex.com/odoo/odoo-12/translate/#fr/base/42?q=text:'This+addon+is+already+installed+on+your+system' Searching on '%s' does not seem to be a number used to give: https://www.transifex.com/odoo/odoo-12/translate/#fr/base/42?q=text:'%5C%27%25s%5C%27+does+not+seem+to+be+a+number+for+field+%5C%27%25%25%28fi' and it now returns: https://www.transifex.com/odoo/odoo-12/translate/#fr/base/42?q=text:'%25s+does+not+seem+to+be+a+number+for+field+%25%25%28fi' closes odoo/odoo#33279 Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
-rw-r--r--addons/transifex/models/ir_translation.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/addons/transifex/models/ir_translation.py b/addons/transifex/models/ir_translation.py
index c19f66c39c1..51edae39206 100644
--- a/addons/transifex/models/ir_translation.py
+++ b/addons/transifex/models/ir_translation.py
@@ -84,8 +84,7 @@ class IrTranslation(models.Model):
'project': project,
'lang': lang_code,
'module': translation.module,
- 'src': werkzeug.url_quote_plus(
- "text:'" +
- translation.source[:50].replace("'", "\\'") +
- "'"),
+ 'src': "text:'" + werkzeug.url_quote_plus(
+ translation.source[:50].replace("\n", "").replace("'", "")
+ ) + "'",
}