public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH widget-toolkit v2] notify ui: fix `gettext` calls
@ 2023-08-28 13:07 Lukas Wagner
  2023-08-31 14:21 ` Lukas Wagner
  0 siblings, 1 reply; 2+ messages in thread
From: Lukas Wagner @ 2023-08-28 13:07 UTC (permalink / raw)
  To: pve-devel

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

Reported-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
---

Changelog v1 -> v2:
  - now with 100% more `gettext` (TM)!

 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..7935dca 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(gettext("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(gettext("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





^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [pve-devel] [PATCH widget-toolkit v2] notify ui: fix `gettext` calls
  2023-08-28 13:07 [pve-devel] [PATCH widget-toolkit v2] notify ui: fix `gettext` calls Lukas Wagner
@ 2023-08-31 14:21 ` Lukas Wagner
  0 siblings, 0 replies; 2+ messages in thread
From: Lukas Wagner @ 2023-08-31 14:21 UTC (permalink / raw)
  To: pve-devel



On 8/28/23 15:07, Lukas Wagner wrote:
> gettext is rather dumb and does not like multi-line strings or string
> interpolation.
> 
> Reported-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
> Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
> ---
> 
> diff --git a/src/panel/NotificationConfigView.js b/src/panel/NotificationConfigView.js
> index 6586524..7935dca 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(gettext("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(gettext("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();

These changes will be incorporated in v2 of the SMTP endpoint patch 
series, otherwise there would be conflicts when applying.

-- 
- Lukas




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-08-31 14:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-28 13:07 [pve-devel] [PATCH widget-toolkit v2] notify ui: fix `gettext` calls Lukas Wagner
2023-08-31 14:21 ` Lukas Wagner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal