From aba467307f8bc456960128360fe7acd75f5fa66d Mon Sep 17 00:00:00 2001 From: barredterra <14891507+barredterra@users.noreply.github.com> Date: Thu, 27 Jan 2022 20:14:51 +0100 Subject: [PATCH] fix: translate default msgprint title in backend --- frappe/__init__.py | 5 ++--- frappe/public/js/frappe/ui/messages.js | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/frappe/__init__.py b/frappe/__init__.py index c6cbfead43..f1e9987f17 100644 --- a/frappe/__init__.py +++ b/frappe/__init__.py @@ -356,7 +356,7 @@ def msgprint(msg, title=None, raise_exception=0, as_table=False, as_list=False, response JSON and shown in a pop-up / modal. :param msg: Message. - :param title: [optional] Message title. + :param title: [optional] Message title. Default: "Message". :param raise_exception: [optional] Raise given exception and show message. :param as_table: [optional] If `msg` is a list of lists, render as HTML table. :param as_list: [optional] If `msg` is a list, render as un-ordered list. @@ -393,8 +393,7 @@ def msgprint(msg, title=None, raise_exception=0, as_table=False, as_list=False, if flags.print_messages and out.message: print(f"Message: {strip_html_tags(out.message)}") - if title: - out.title = title + out.title = title or _("Message", context="Default title of the message dialog") if not indicator and raise_exception: indicator = 'red' diff --git a/frappe/public/js/frappe/ui/messages.js b/frappe/public/js/frappe/ui/messages.js index ac0c01c406..f0d03f0743 100644 --- a/frappe/public/js/frappe/ui/messages.js +++ b/frappe/public/js/frappe/ui/messages.js @@ -233,7 +233,7 @@ frappe.msgprint = function(msg, title, is_minimizable) { if(data.title || !msg_exists) { // set title only if it is explicitly given // and no existing title exists - frappe.msg_dialog.set_title(data.title || __('Message')); + frappe.msg_dialog.set_title(data.title || __('Message', null, 'Default title of the message dialog')); } // show / hide indicator