[pve-devel] [PATCH manager 1/2] fix gettext strings

Dominik Csapak d.csapak at proxmox.com
Tue Jan 10 10:40:16 CET 2017


we expect a gettext on a single line and to not contain any
variable/logic, so we remove the long text from it altogether (since we
do not want to translate that at the moment), and we rearrange the code
so that gettext only contains strings

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/form/GuestIDSelector.js | 16 ++++++++--------
 www/manager6/ha/ResourceEdit.js      |  8 ++++----
 www/manager6/node/StatusView.js      |  5 ++++-
 www/manager6/qemu/QemuBiosEdit.js    |  4 ++--
 4 files changed, 18 insertions(+), 15 deletions(-)

diff --git a/www/manager6/form/GuestIDSelector.js b/www/manager6/form/GuestIDSelector.js
index 819cef9..298988d 100644
--- a/www/manager6/form/GuestIDSelector.js
+++ b/www/manager6/form/GuestIDSelector.js
@@ -17,21 +17,21 @@ Ext.define('PVE.form.GuestIDSelector', {
     initComponent: function() {
 	var me = this;
 	var label = '{0} ID';
-	var unknownID = 'This {0} ID does not exists';
-	var inUseID = 'This {0} ID is already in use';
+	var unknownID = gettext('This {0} ID does not exists');
+	var inUseID = gettext('This {0} ID is already in use');
 
 	if (me.guestType === 'lxc') {
 	    label = Ext.String.format(label, 'CT');
-	    unknownID = Ext.String.format(gettext(unknownID), 'CT');
-	    inUseID = Ext.String.format(gettext(inUseID), 'CT');
+	    unknownID = Ext.String.format(unknownID, 'CT');
+	    inUseID = Ext.String.format(inUseID, 'CT');
 	} else if (me.guestType === 'qemu') {
 	    label = Ext.String.format(label, 'VM');
-	    unknownID = Ext.String.format(gettext(unknownID), 'VM');
-	    inUseID = Ext.String.format(gettext(inUseID), 'VM');
+	    unknownID = Ext.String.format(unknownID, 'VM');
+	    inUseID = Ext.String.format(inUseID, 'VM');
 	} else {
 	    label = Ext.String.format(label, 'CT/VM');
-	    unknownID = Ext.String.format(gettext(unknownID), 'CT/VM');
-	    inUseID = Ext.String.format(gettext(inUseID), 'CT/VM');
+	    unknownID = Ext.String.format(unknownID, 'CT/VM');
+	    inUseID = Ext.String.format(inUseID, 'CT/VM');
 	}
 
 	Ext.apply(me, {
diff --git a/www/manager6/ha/ResourceEdit.js b/www/manager6/ha/ResourceEdit.js
index 06dda10..c3c9135 100644
--- a/www/manager6/ha/ResourceEdit.js
+++ b/www/manager6/ha/ResourceEdit.js
@@ -27,8 +27,8 @@ Ext.define('PVE.ha.VMResourceInputPanel', {
 	var disabledHint = Ext.createWidget({
 	    xtype: 'displayfield', //submitValue is false, so we don't get submitted
 	    userCls: 'pve-hint',
-	    value: gettext('Disabling the resource will stop the guest system. ' +
-	    'See the online help for details.'),
+	    value: 'Disabling the resource will stop the guest system. ' +
+	    'See the online help for details.',
 	    hidden: true
 	});
 
@@ -38,8 +38,8 @@ Ext.define('PVE.ha.VMResourceInputPanel', {
 	    userCls: 'pve-hint',
 	    updateValue: function(votes) {
 		var me = this;
-		me.setValue(gettext('You need at least three quorum votes for a reliable HA cluster. ' +
-		'See the online help for details. Current votes: ') + votes);
+		me.setValue('You need at least three quorum votes for a reliable HA cluster. ' +
+		'See the online help for details. Current votes: ' + votes);
 	    },
 	    hidden: true
 	});
diff --git a/www/manager6/node/StatusView.js b/www/manager6/node/StatusView.js
index 54e618e..08a984c 100644
--- a/www/manager6/node/StatusView.js
+++ b/www/manager6/node/StatusView.js
@@ -88,7 +88,10 @@ Ext.define('PVE.node.StatusView', {
 	    renderer: function(cpuinfo) {
 		return cpuinfo.cpus + " x " + cpuinfo.model + " (" +
 		cpuinfo.sockets.toString() + " " +
-		gettext('Socket' + (cpuinfo.sockets > 1 ? 's': '')) + ")";
+		(cpuinfo.sockets > 1 ?
+		    gettext('Sockets') :
+		    gettext('Socket')
+		) + ")";
 	    },
 	    value: '',
 	    width: 730
diff --git a/www/manager6/qemu/QemuBiosEdit.js b/www/manager6/qemu/QemuBiosEdit.js
index 2212652..d5abbe3 100644
--- a/www/manager6/qemu/QemuBiosEdit.js
+++ b/www/manager6/qemu/QemuBiosEdit.js
@@ -8,8 +8,8 @@ Ext.define('PVE.qemu.BiosEdit', {
 	var EFIHint = Ext.createWidget({
 	    xtype: 'displayfield', //submitValue is false, so we don't get submitted
 	    userCls: 'pve-hint',
-	    value: gettext('You need to add an EFI disk for storing the ' +
-	    'EFI settings. See the online help for details.'),
+	    value: 'You need to add an EFI disk for storing the ' +
+	    'EFI settings. See the online help for details.',
 	    hidden: true
 	});
 
-- 
2.1.4





More information about the pve-devel mailing list