summaryrefslogtreecommitdiff
path: root/addons/auth_signup/models
diff options
context:
space:
mode:
authorOdoo's Mergebot <xmo+roboto@odoo.com>2020-06-18 13:51:48 +0200
committerGitHub <noreply@github.com>2020-06-18 13:51:48 +0200
commite617aa91c536093f481da28b0cf061a6abe55b2a (patch)
tree74fbff684e24f5389db77e63ee74f236039a3afb /addons/auth_signup/models
parentcb7a7deec5c1eda8c156e1b1f9e1f1e38d0abda2 (diff)
parent80e97e98ce76067db1079af8feeef667cfadf837 (diff)
[MERGE] tools: better placeholder support for _
Support two new syntaxes with `_()` method: _("This is so %s") % 2019 _("Text with %s placeholders", 42) _("Text with %(num)s placeholders %(symbol)s", num=42, symbol="🧀") The main benefit is to have a fallback on the source string if formating the translated string fails (e.g. "Foo %s" translated "Foo s%"). This PR converted most (but not all) calls to _ using placeholders to use the new syntax. Hopefully, the remaining ones will be converted in the future and avoid technical debt. Use named placeholders when needed. If more than one placeholder is present in a string, using named placeholder can be beneficial to reorder the placehodler position (for languages like Japanese that do not use the same phrase construction). On some sentences, it also brings clarity on the meaning of the placeholders. closes odoo/odoo#52155 Task-id: 1853119 Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
Diffstat (limited to 'addons/auth_signup/models')
-rw-r--r--addons/auth_signup/models/res_partner.py4
-rw-r--r--addons/auth_signup/models/res_users.py4
2 files changed, 4 insertions, 4 deletions
diff --git a/addons/auth_signup/models/res_partner.py b/addons/auth_signup/models/res_partner.py
index 94e8471e00b..fe68ae5380d 100644
--- a/addons/auth_signup/models/res_partner.py
+++ b/addons/auth_signup/models/res_partner.py
@@ -143,11 +143,11 @@ class ResPartner(models.Model):
partner = self.search([('signup_token', '=', token)], limit=1)
if not partner:
if raise_exception:
- raise exceptions.UserError(_("Signup token '%s' is not valid") % token)
+ raise exceptions.UserError(_("Signup token '%s' is not valid", token))
return False
if check_validity and not partner.signup_valid:
if raise_exception:
- raise exceptions.UserError(_("Signup token '%s' is no longer valid") % token)
+ raise exceptions.UserError(_("Signup token '%s' is no longer valid", token))
return False
return partner
diff --git a/addons/auth_signup/models/res_users.py b/addons/auth_signup/models/res_users.py
index c600d969e9d..3aaa43f0f18 100644
--- a/addons/auth_signup/models/res_users.py
+++ b/addons/auth_signup/models/res_users.py
@@ -123,7 +123,7 @@ class ResUsers(models.Model):
invite_partner = user.create_uid.partner_id
if invite_partner:
# notify invite user that new user is connected
- title = _("%s connected") % user.name
+ title = _("%s connected", user.name)
message = _("This is his first connection. Wish him welcome")
self.env['bus.bus'].sendone(
(self._cr.dbname, 'res.partner', invite_partner.id),
@@ -196,7 +196,7 @@ class ResUsers(models.Model):
for user in self:
if not user.email:
- raise UserError(_("Cannot send email: user %s has no email address.") % user.name)
+ raise UserError(_("Cannot send email: user %s has no email address.", user.name))
# TDE FIXME: make this template technical (qweb)
with self.env.cr.savepoint():
force_send = not(self.env.context.get('import_file', False))