From 10744d133261b765d46d75310e71c208ea643408 Mon Sep 17 00:00:00 2001 From: Mihir Kandoi Date: Thu, 25 Jun 2026 16:22:04 +0530 Subject: [PATCH] chore: rewrite user-facing messages in Utilities 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. --- erpnext/utilities/__init__.py | 2 +- erpnext/utilities/bulk_transaction.py | 2 +- erpnext/utilities/doctype/video_settings/video_settings.py | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/erpnext/utilities/__init__.py b/erpnext/utilities/__init__.py index 66a038bd52a..9684ae7fe80 100644 --- a/erpnext/utilities/__init__.py +++ b/erpnext/utilities/__init__.py @@ -48,7 +48,7 @@ def get_site_info(site_info): def payment_app_import_guard(): marketplace_link = 'Marketplace' github_link = 'GitHub' - msg = _("payments app is not installed. Please install it from {} or {}").format( + msg = _("payments app is not installed. Please install it from {0} or {1}").format( marketplace_link, github_link ) try: diff --git a/erpnext/utilities/bulk_transaction.py b/erpnext/utilities/bulk_transaction.py index 33a0fa7f73f..b8cf42c53cb 100644 --- a/erpnext/utilities/bulk_transaction.py +++ b/erpnext/utilities/bulk_transaction.py @@ -30,7 +30,7 @@ def transaction_processing( skipped_msg += ( "

" ) diff --git a/erpnext/utilities/doctype/video_settings/video_settings.py b/erpnext/utilities/doctype/video_settings/video_settings.py index 762a795a733..34e65a35c3f 100644 --- a/erpnext/utilities/doctype/video_settings/video_settings.py +++ b/erpnext/utilities/doctype/video_settings/video_settings.py @@ -30,6 +30,8 @@ class VideoSettings(Document): try: build("youtube", "v3", developerKey=self.api_key) except Exception: - title = _("Failed to Authenticate the API key.") self.log_error("Failed to authenticate API key") - frappe.throw(title + " Please check the error logs.", title=_("Invalid Credentials")) + frappe.throw( + _("Failed to authenticate the API key. Please check the error logs."), + title=_("Invalid Credentials"), + )