From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <pve-devel-bounces@lists.proxmox.com> Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 984AB1FF162 for <inbox@lore.proxmox.com>; Mon, 7 Apr 2025 11:17:03 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id D2B7E39C79; Mon, 7 Apr 2025 11:16:55 +0200 (CEST) From: Christoph Heiss <c.heiss@proxmox.com> To: pve-devel@lists.proxmox.com Date: Mon, 7 Apr 2025 11:16:27 +0200 Message-ID: <20250407091647.202800-1-c.heiss@proxmox.com> X-Mailer: git-send-email 2.48.1 MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.029 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH manager v2 1/2] window: migrate: make all user-visible strings translatable X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com> List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe> List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/> List-Post: <mailto:pve-devel@lists.proxmox.com> List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help> List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe> Reply-To: Proxmox VE development discussion <pve-devel@lists.proxmox.com> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" <pve-devel-bounces@lists.proxmox.com> 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