public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH manager v2 1/2] window: migrate: make all user-visible strings translatable
@ 2025-04-07  9:16 Christoph Heiss
  2025-04-07  9:16 ` [pve-devel] [PATCH manager v2 2/2] window: migrate: use predefined constant for error alert title Christoph Heiss
  2025-04-07 10:06 ` [pve-devel] [PATCH manager v2 1/2] window: migrate: make all user-visible strings translatable Thomas Lamprecht
  0 siblings, 2 replies; 4+ messages in thread
From: Christoph Heiss @ 2025-04-07  9:16 UTC (permalink / raw)
  To: pve-devel

Quite a few user-visible strings in the dialog currently are not using
gettext(), thus not making them translatable.

While at it, also remove some contractions from error/warning messages.
Not strictly necessary per our style guide, but it avoids escaping
single quotes and reads quite a bit nicer IMHO.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
---
Changes v1 -> v2:
  * rebased on latest master, for the recently-applied live-migration
    series

The contractions change is obviously opinionated, but can be changed
back of course if desired - no hard feelings from my side.

 www/manager6/window/Migrate.js | 78 ++++++++++++++++++----------------
 1 file changed, 42 insertions(+), 36 deletions(-)

diff --git a/www/manager6/window/Migrate.js b/www/manager6/window/Migrate.js
index dba5556b6..ab0239eaf 100644
--- a/www/manager6/window/Migrate.js
+++ b/www/manager6/window/Migrate.js
@@ -222,25 +222,26 @@ Ext.define('PVE.window.Migrate', {
 		if (target.length && !migrateStats.allowed_nodes.includes(target)) {
 		    if (disallowed.unavailable_storages !== undefined) {
 			let missingStorages = disallowed.unavailable_storages.join(', ');
+			const text = Ext.String.format(
+			    gettext('Storage(s) ({0}) not available on selected target. Start VM to use live storage migration or select other target node.'),
+			    missingStorages,
+			);
 
 			migration.possible = false;
-			migration.preconditions.push({
-			    text: 'Storage (' + missingStorages + ') not available on selected target. ' +
-			      'Start VM to use live storage migration or select other target node',
-			    severity: 'error',
-			});
+			migration.preconditions.push({ text, severity: 'error' });
 		    }
 		}
 	    }
 
 	    if (disallowed['unavailable-resources'] !== undefined) {
 		let unavailableResources = disallowed['unavailable-resources'].join(', ');
+		const text = Ext.String.format(
+		    gettext('Mapped Resources ({0}) not available on selected target.'),
+		    unavailableResources,
+		);
 
 		migration.possible = false;
-		migration.preconditions.push({
-		    text: 'Mapped Resources (' + unavailableResources + ') not available on selected target. ',
-		    severity: 'error',
-		});
+		migration.preconditions.push({ text, severity: 'error' });
 	    }
 
 	    let blockingResources = [];
@@ -255,19 +256,20 @@ Ext.define('PVE.window.Migrate', {
 	    if (blockingResources.length) {
 		migration.hasLocalResources = true;
 		if (!migration.overwriteLocalResourceCheck || vm.get('running')) {
+		    const text = Ext.String.format(
+			gettext('Cannot migrate VM with local resources: {0}'),
+			blockingResources.join(', '),
+		    );
+
 		    migration.possible = false;
-		    migration.preconditions.push({
-			text: Ext.String.format('Can\'t migrate VM with local resources: {0}',
-			blockingResources.join(', ')),
-			severity: 'error',
-		    });
+		    migration.preconditions.push({ text, severity: 'error' });
 		} else {
-		    migration.preconditions.push({
-			text: Ext.String.format('Migrate VM with local resources: {0}. ' +
-			'This might fail if resources aren\'t available on the target node.',
-			blockingResources.join(', ')),
-			severity: 'warning',
-		    });
+		    const text = Ext.String.format(
+			gettext('Migrating VM with local resources: {0}. This might fail if the resources are not available on the target node.'),
+			blockingResources.join(', '),
+		    );
+
+		    migration.preconditions.push({ text, severity: 'warning' });
 		}
 	    }
 
@@ -282,18 +284,20 @@ Ext.define('PVE.window.Migrate', {
 		    }
 		}
 		if (notAllowed.length > 0) {
+		    const text = Ext.String.format(
+			gettext('Cannot migrate running VM with mapped resources: {0}'),
+			notAllowed.join(', '),
+		    );
+
 		    migration.possible = false;
-		    migration.preconditions.push({
-			text: Ext.String.format('Can\'t migrate running VM with mapped resources: {0}',
-			notAllowed.join(', ')),
-			severity: 'error',
-		    });
+		    migration.preconditions.push({ text, severity: 'error' });
 		} else if (allowed.length > 0) {
-		    migration.preconditions.push({
-			text: Ext.String.format('Live-migrating running VM with mapped resources (Experimental): {0}',
-			allowed.join(', ')),
-			severity: 'warning',
-		    });
+		    const text = Ext.String.format(
+			gettext('Live-migrating running VM with mapped resources (Experimental): {0}'),
+			allowed.join(', '),
+		    );
+
+		    migration.preconditions.push({ text, severity: 'warning' });
 		}
 	    }
 
@@ -303,17 +307,19 @@ Ext.define('PVE.window.Migrate', {
 			if (!disk.volid.includes('vm-' + vm.get('vmid') + '-cloudinit')) {
 			    migration.possible = false;
 			    migration.preconditions.push({
-				text: "Can't migrate VM with local CD/DVD",
+				text: gettext('Cannot migrate VM with local CD/DVD'),
 				severity: 'error',
 			    });
 			}
 		    } else {
 			let size = disk.size ? '(' + Proxmox.Utils.render_size(disk.size) + ')' : '';
+			const text = Ext.String.format(
+			    gettext('Migration with local disk might take long: {0} {1}'),
+			    disk.volid, size,
+			);
+
 			migration['with-local-disks'] = 1;
-			migration.preconditions.push({
-			    text: Ext.String.format('Migration with local disk might take long: {0} {1}', disk.volid, size),
-			    severity: 'warning',
-			});
+			migration.preconditions.push({ text, severity: 'warning' });
 		    }
 		});
 	    }
@@ -397,7 +403,7 @@ Ext.define('PVE.window.Migrate', {
 			fieldLabel: gettext('Force'),
 			autoEl: {
 			    tag: 'div',
-			    'data-qtip': 'Overwrite local resources unavailable check',
+			    'data-qtip': gettext('Overwrite local resources unavailable check'),
 			},
 			bind: {
 			    hidden: '{setLocalResourceCheckboxHidden}',
-- 
2.48.1



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


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

* [pve-devel] [PATCH manager v2 2/2] window: migrate: use predefined constant for error alert title
  2025-04-07  9:16 [pve-devel] [PATCH manager v2 1/2] window: migrate: make all user-visible strings translatable Christoph Heiss
@ 2025-04-07  9:16 ` Christoph Heiss
  2025-04-07 10:06 ` [pve-devel] [PATCH manager v2 1/2] window: migrate: make all user-visible strings translatable Thomas Lamprecht
  1 sibling, 0 replies; 4+ messages in thread
From: Christoph Heiss @ 2025-04-07  9:16 UTC (permalink / raw)
  To: pve-devel

This is already defined, so use it where possible.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
---
Changes v1 -> v2:
  * no changes

 www/manager6/window/Migrate.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/www/manager6/window/Migrate.js b/www/manager6/window/Migrate.js
index ab0239eaf..8b1dbef89 100644
--- a/www/manager6/window/Migrate.js
+++ b/www/manager6/window/Migrate.js
@@ -139,7 +139,7 @@ Ext.define('PVE.window.Migrate', {
 		waitMsgTarget: view,
 		method: 'POST',
 		failure: function(response, opts) {
-		    Ext.Msg.alert(gettext('Error'), response.htmlStatus);
+		    Ext.Msg.alert(Proxmox.Utils.errorText, response.htmlStatus);
 		},
 		success: function(response, options) {
 		    var upid = response.result.data;
@@ -201,7 +201,7 @@ Ext.define('PVE.window.Migrate', {
 		migrateStats = result.data;
 		me.fetchingNodeMigrateInfo = false;
 	    } catch (error) {
-		Ext.Msg.alert(gettext('Error'), error.htmlStatus);
+		Ext.Msg.alert(Proxmox.Utils.errorText, error.htmlStatus);
 		return;
 	    }
 
-- 
2.48.1



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


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

* Re: [pve-devel] [PATCH manager v2 1/2] window: migrate: make all user-visible strings translatable
  2025-04-07  9:16 [pve-devel] [PATCH manager v2 1/2] window: migrate: make all user-visible strings translatable Christoph Heiss
  2025-04-07  9:16 ` [pve-devel] [PATCH manager v2 2/2] window: migrate: use predefined constant for error alert title Christoph Heiss
@ 2025-04-07 10:06 ` Thomas Lamprecht
  2025-04-07 10:49   ` Christoph Heiss
  1 sibling, 1 reply; 4+ messages in thread
From: Thomas Lamprecht @ 2025-04-07 10:06 UTC (permalink / raw)
  To: pve-devel, Christoph Heiss


On Mon, 07 Apr 2025 11:16:27 +0200, Christoph Heiss wrote:
> Quite a few user-visible strings in the dialog currently are not using
> gettext(), thus not making them translatable.
> 
> While at it, also remove some contractions from error/warning messages.
> Not strictly necessary per our style guide, but it avoids escaping
> single quotes and reads quite a bit nicer IMHO.
> 
> [...]

Applied, fixed the subject to start with a `ui` tag and then
use a slightly more verbose `guest migrate window` second
level tag, thanks!

[1/2] ui: guest migrate window: make all user-visible strings translatable
      commit: 5c8e6e5a6e97f418452196642bcdcacfbd68bb25
[2/2] ui: guest migrate window: use predefined constant for error alert title
      commit: 29e53e5f46b2e4015fda12375668ead019c27902


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


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

* Re: [pve-devel] [PATCH manager v2 1/2] window: migrate: make all user-visible strings translatable
  2025-04-07 10:06 ` [pve-devel] [PATCH manager v2 1/2] window: migrate: make all user-visible strings translatable Thomas Lamprecht
@ 2025-04-07 10:49   ` Christoph Heiss
  0 siblings, 0 replies; 4+ messages in thread
From: Christoph Heiss @ 2025-04-07 10:49 UTC (permalink / raw)
  To: Thomas Lamprecht; +Cc: pve-devel

On Mon Apr 7, 2025 at 12:06 PM CEST, Thomas Lamprecht wrote:
>
> On Mon, 07 Apr 2025 11:16:27 +0200, Christoph Heiss wrote:
>> Quite a few user-visible strings in the dialog currently are not using
>> gettext(), thus not making them translatable.
>>
>> While at it, also remove some contractions from error/warning messages.
>> Not strictly necessary per our style guide, but it avoids escaping
>> single quotes and reads quite a bit nicer IMHO.
>>
>> [...]
>
> Applied, fixed the subject to start with a `ui` tag and then
> use a slightly more verbose `guest migrate window` second
> level tag, thanks!

Thanks! Not sure how I missed the `ui:` commit tag on this, will do a
double-take on this matter in the future.


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


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

end of thread, other threads:[~2025-04-07 10:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-07  9:16 [pve-devel] [PATCH manager v2 1/2] window: migrate: make all user-visible strings translatable Christoph Heiss
2025-04-07  9:16 ` [pve-devel] [PATCH manager v2 2/2] window: migrate: use predefined constant for error alert title Christoph Heiss
2025-04-07 10:06 ` [pve-devel] [PATCH manager v2 1/2] window: migrate: make all user-visible strings translatable Thomas Lamprecht
2025-04-07 10:49   ` Christoph Heiss

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