Skip to content

Commit 7c0a656

Browse files
author
KHALID SAHIH
committed
[FIX] mail_server_manager: Remove variables from translation strings
- Simplify all translated messages to be static strings - Remove dynamic variables to comply with OCA translation guidelines
1 parent b4dfb86 commit 7c0a656

File tree

2 files changed

+8
-29
lines changed

2 files changed

+8
-29
lines changed

mail_server_manager/models/mail_account.py

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -141,36 +141,22 @@ def _check_email_format(self):
141141

142142
# SECURITY: Strict regex validation to prevent file injection
143143
if not self._EMAIL_REGEX.match(record.email):
144-
raise ValidationError(
145-
self.env._(
146-
"Invalid email address format: '%s'.\n\n"
147-
"Only alphanumeric characters, dots, underscores, hyphens, "
148-
"and plus signs are allowed."
149-
)
150-
% record.email
151-
)
144+
raise ValidationError(self.env._("Invalid email address format."))
152145

153146
# Validate using Odoo's email_normalize
154147
normalized = email_normalize(record.email)
155148
if not normalized:
156-
raise ValidationError(
157-
self.env._("Invalid email address: '%s'.").format(
158-
email=record.email
159-
)
160-
)
149+
raise ValidationError(self.env._("Invalid email address."))
161150

162151
# Check domain part
163152
local_part, domain = record.email.split("@")
164153
if not local_part or not domain:
165154
raise ValidationError(
166-
self.env._("Invalid email address: '%s'. Missing username..")
167-
% record.email
155+
self.env._("Invalid email address: missing username.")
168156
)
169157

170158
if "." not in domain:
171-
raise ValidationError(
172-
self.env._("Invalid domain: '%s'. Must contain a dot.") % domain
173-
)
159+
raise ValidationError(self.env._("Invalid domain: must contain a dot."))
174160

175161
# Note: _get_mail_domain, _get_mail_config_path, _get_smtp_host,
176162
# _get_imap_host, _get_imap_port are inherited from mail.server.manager.mixin
@@ -822,7 +808,7 @@ def action_sync_from_server(self):
822808
"tag": "display_notification",
823809
"params": {
824810
"title": self.env._("Sync Completed"),
825-
"message": self.env._("%d new accounts imported.").format(count=synced),
811+
"message": self.env._("Sync completed successfully."),
826812
"type": "success",
827813
},
828814
}
@@ -950,10 +936,7 @@ def action_fix_smtp_owner(self):
950936
"tag": "display_notification",
951937
"params": {
952938
"title": self.env._("SMTP Servers Fixed"),
953-
"message": self.env._(
954-
"%d SMTP server(s) updated with correct from_filter."
955-
)
956-
% fixed_count,
939+
"message": self.env._("SMTP servers updated successfully."),
957940
"type": "success",
958941
},
959942
}
@@ -991,10 +974,7 @@ def action_fix_all_smtp_owners(self):
991974
"tag": "display_notification",
992975
"params": {
993976
"title": self.env._("Batch Fix Complete"),
994-
"message": self.env._(
995-
"%d SMTP server(s) fixed with correct from_filter."
996-
)
997-
% fixed_count,
977+
"message": self.env._("SMTP servers fixed successfully."),
998978
"type": "success",
999979
},
1000980
}

mail_server_manager/models/mail_mail.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,9 @@ def _check_email_limit(self, mail_account):
136136
if mail_account.emails_sent_today >= limit:
137137
raise UserError(
138138
self.env._(
139-
"Daily email limit reached (%s emails). "
139+
"Daily email limit reached. "
140140
"Please try again tomorrow or contact your administrator."
141141
)
142-
% limit
143142
)
144143

145144
return True

0 commit comments

Comments
 (0)