chore: rewrite user-facing messages in Setup 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:11:38 +05:30
parent 9b4c8a8d7f
commit 4b8b52b908
3 changed files with 5 additions and 3 deletions

View File

@@ -46,7 +46,9 @@ class ItemGroup(NestedSet):
frappe.throw(
_("{0} entered twice {1} in Item Taxes").format(
frappe.bold(d.item_tax_template),
f"for tax category {frappe.bold(d.tax_category)}" if d.tax_category else "",
_("for tax category {0}").format(frappe.bold(d.tax_category))
if d.tax_category
else "",
)
)
else:

View File

@@ -646,7 +646,7 @@ class TransactionDeletionRecord(Document):
def validate_doc_status(self):
if self.status != "Running":
frappe.throw(
_("{0} is not running. Cannot trigger events for this Document").format(
_("{0} is not running. Cannot trigger events for this document").format(
get_link_to_form("Transaction Deletion Record", self.name)
)
)

View File

@@ -11,7 +11,7 @@ from frappe import _
def setup_taxes_and_charges(company_name: str, country: str):
if not frappe.db.exists("Company", company_name):
frappe.throw(_("Company {} does not exist yet. Taxes setup aborted.").format(company_name))
frappe.throw(_("Company {0} does not exist yet. Taxes setup aborted.").format(company_name))
file_path = os.path.join(os.path.dirname(__file__), "..", "data", "country_wise_tax.json")
with open(file_path) as json_file: