[pve-devel] [PATCH widget-toolkit] notify ui: fix `gettext` calls

Lukas Wagner l.wagner at proxmox.com
Mon Aug 28 14:59:59 CEST 2023


gettext is rather dumb and does not like multi-line strings or string
interpolation.

Reported-by: Maximiliano Sandoval <m.sandoval at proxmox.com>
Signed-off-by: Lukas Wagner <l.wagner at proxmox.com>
---
 src/panel/NotificationConfigView.js | 4 ++--
 src/panel/SendmailEditPanel.js      | 4 +---
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/panel/NotificationConfigView.js b/src/panel/NotificationConfigView.js
index 6586524..b95eda9 100644
--- a/src/panel/NotificationConfigView.js
+++ b/src/panel/NotificationConfigView.js
@@ -88,7 +88,7 @@ Ext.define('Proxmox.panel.NotificationEndpointView', {
 
 	    Ext.Msg.confirm(
 		gettext("Notification Target Test"),
-		gettext(`Do you want to send a test notification to '${target}'?`),
+		Ext.String.format("Do you want to send a test notification to '{0}'?", target),
 		function(decision) {
 		    if (decision !== "yes") {
 			return;
@@ -101,7 +101,7 @@ Ext.define('Proxmox.panel.NotificationEndpointView', {
 			success: function(response, opt) {
 			    Ext.Msg.show({
 				title: gettext('Notification Target Test'),
-				message: gettext(`Sent test notification to '${target}'.`),
+				message: Ext.String.format("Sent test notification to '{0}'.", target),
 				buttons: Ext.Msg.OK,
 				icon: Ext.Msg.INFO,
 			    });
diff --git a/src/panel/SendmailEditPanel.js b/src/panel/SendmailEditPanel.js
index b814f39..ace6129 100644
--- a/src/panel/SendmailEditPanel.js
+++ b/src/panel/SendmailEditPanel.js
@@ -80,9 +80,7 @@ Ext.define('Proxmox.panel.SendmailEditPanel', {
 	    },
 	    autoEl: {
 		tag: 'div',
-		'data-qtip': gettext(
-		    'Multiple recipients must be separated by spaces, commas or semicolons',
-		),
+		'data-qtip': gettext('Multiple recipients must be separated by spaces, commas or semicolons'),
 	    },
 	    validator: function() {
 		return this.up('pmxSendmailEditPanel').mailValidator();
-- 
2.39.2






More information about the pve-devel mailing list