From daa6c617d444b8c718095dcd1cd697c2a29e3f46 Mon Sep 17 00:00:00 2001 From: barredterra <14891507+barredterra@users.noreply.github.com> Date: Fri, 16 Aug 2024 20:58:55 +0200 Subject: [PATCH] fix: translatability of boldened text --- .../automation/doctype/assignment_rule/assignment_rule.py | 4 +++- frappe/automation/doctype/auto_repeat/auto_repeat.py | 8 ++++++-- frappe/contacts/doctype/contact/contact.py | 2 +- .../social/doctype/energy_point_log/energy_point_log.py | 7 +++---- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/frappe/automation/doctype/assignment_rule/assignment_rule.py b/frappe/automation/doctype/assignment_rule/assignment_rule.py index 5b8ec54df2..a65eb92f1d 100644 --- a/frappe/automation/doctype/assignment_rule/assignment_rule.py +++ b/frappe/automation/doctype/assignment_rule/assignment_rule.py @@ -51,7 +51,9 @@ class AssignmentRule(Document): def validate_document_types(self): if self.document_type == "ToDo": - frappe.throw(_("Assignment Rule is not allowed on {0} document type").format(frappe.bold("ToDo"))) + frappe.throw( + _("Assignment Rule is not allowed on document type {0}").format(frappe.bold(_("ToDo"))) + ) def validate_assignment_days(self): assignment_days = self.get_assignment_days() diff --git a/frappe/automation/doctype/auto_repeat/auto_repeat.py b/frappe/automation/doctype/auto_repeat/auto_repeat.py index f71b4d219b..c2f7a117e5 100644 --- a/frappe/automation/doctype/auto_repeat/auto_repeat.py +++ b/frappe/automation/doctype/auto_repeat/auto_repeat.py @@ -122,7 +122,9 @@ class AutoRepeat(Document): def validate_submit_on_creation(self): if self.submit_on_creation and not frappe.get_meta(self.reference_doctype).is_submittable: frappe.throw( - _("Cannot enable {0} for a non-submittable doctype").format(frappe.bold("Submit on Creation")) + _("Cannot enable {0} for a non-submittable doctype").format( + frappe.bold(_("Submit on Creation")) + ) ) def validate_dates(self): @@ -134,7 +136,9 @@ class AutoRepeat(Document): if self.end_date == self.start_date: frappe.throw( - _("{0} should not be same as {1}").format(frappe.bold("End Date"), frappe.bold("Start Date")) + _("{0} should not be same as {1}").format( + frappe.bold(_("End Date")), frappe.bold(_("Start Date")) + ) ) def validate_email_id(self): diff --git a/frappe/contacts/doctype/contact/contact.py b/frappe/contacts/doctype/contact/contact.py index cf7c1064e5..3d9c05dba9 100644 --- a/frappe/contacts/doctype/contact/contact.py +++ b/frappe/contacts/doctype/contact/contact.py @@ -128,7 +128,7 @@ class Contact(Document): return if len([email.email_id for email in self.email_ids if email.is_primary]) > 1: - frappe.throw(_("Only one {0} can be set as primary.").format(frappe.bold("Email ID"))) + frappe.throw(_("Only one {0} can be set as primary.").format(frappe.bold(_("Email ID")))) if len(self.email_ids) == 1: self.email_ids[0].is_primary = 1 diff --git a/frappe/social/doctype/energy_point_log/energy_point_log.py b/frappe/social/doctype/energy_point_log/energy_point_log.py index a124050305..b9cbf6f7cd 100644 --- a/frappe/social/doctype/energy_point_log/energy_point_log.py +++ b/frappe/social/doctype/energy_point_log/energy_point_log.py @@ -115,12 +115,11 @@ def get_notification_message(doc): title = get_title(doc.reference_doctype, doc.reference_name) if doc.type == "Auto": - owner_name = frappe.bold("You") if points == 1: - message = _("{0} gained {1} point for {2} {3}") + message = _("You gained {1} point for {2} {3}") else: - message = _("{0} gained {1} points for {2} {3}") - message = message.format(owner_name, frappe.bold(points), doc.rule, get_title_html(title)) + message = _("You gained {1} points for {2} {3}") + message = message.format(frappe.bold(points), doc.rule, get_title_html(title)) elif doc.type == "Appreciation": if points == 1: message = _("{0} appreciated your work on {1} with {2} point")