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.he...@proxmox.com>
---
The contractions change is obviously opinionated, happy to change it
back if desired.

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

diff --git a/www/manager6/window/Migrate.js b/www/manager6/window/Migrate.js
index 78d03921e..c300f8d35 100644
--- a/www/manager6/window/Migrate.js
+++ b/www/manager6/window/Migrate.js
@@ -222,23 +222,23 @@ Ext.define('PVE.window.Migrate', {
                    let disallowed = migrateStats.not_allowed_nodes[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' 
});
                    }
                }
            }
@@ -255,30 +255,32 @@ 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' });
                }
            }
 
            if (mappedResources && mappedResources.length) {
                if (vm.get('running')) {
+                   const text = Ext.String.format(
+                       gettext('Cannot migrate running VM with mapped 
resources: {0}'),
+                       mappedResources.join(', '),
+                   );
+
                    migration.possible = false;
-                   migration.preconditions.push({
-                       text: Ext.String.format('Can\'t migrate running VM with 
mapped resources: {0}',
-                       mappedResources.join(', ')),
-                       severity: 'error',
-                   });
+                   migration.preconditions.push({ text, severity: 'error' });
                }
            }
 
@@ -288,17 +290,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' });
                    }
                });
            }
@@ -382,7 +386,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

Reply via email to