chore: rewrite user-facing messages in Maintenance module

Conservative cleanup of frappe.throw/msgprint messages per the message style
guide; meaning, severity, and .format() arguments are unchanged:

- index bare {} placeholders as {0}/{1}/... so translators can reorder
- move f-strings / .format() / concatenation out of _() (they break gettext
  extraction and never translate)
- wrap translatable dynamic values (DocType/Select labels) in _()
- fix grammar and colloquialisms
- drop no-op _() wrapping runtime-built strings

Part of #53976.
This commit is contained in:
Mihir Kandoi
2026-06-25 16:21:49 +05:30
parent 7124e47490
commit fa9fb12c8d

View File

@@ -294,10 +294,11 @@ class MaintenanceSchedule(TransactionBase):
for row in voucher_nos:
if row.voucher_type != "Maintenance Schedule":
msg = f"""Serial and Batch Bundle {row.name}
should have voucher type as 'Maintenance Schedule'"""
frappe.throw(_(msg))
frappe.throw(
_(
"Serial and Batch Bundle {0} should have voucher type as 'Maintenance Schedule'"
).format(row.name)
)
def on_update(self):
self.db_set("status", "Draft")
@@ -332,14 +333,14 @@ class MaintenanceSchedule(TransactionBase):
amc_start_date
):
throw(
_("Serial No {0} is under warranty upto {1}").format(
_("Serial No {0} is under warranty until {1}").format(
serial_no, sr_details.warranty_expiry_date
)
)
if sr_details.amc_expiry_date and getdate(sr_details.amc_expiry_date) >= getdate(amc_start_date):
throw(
_("Serial No {0} is under maintenance contract upto {1}").format(
_("Serial No {0} is under maintenance contract until {1}").format(
serial_no, sr_details.amc_expiry_date
)
)