public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH manager] ui: mark strings translatable
@ 2023-11-28 13:28 Maximiliano Sandoval
  2023-11-28 13:31 ` Maximiliano Sandoval
  2023-11-28 14:39 ` Dietmar Maurer
  0 siblings, 2 replies; 11+ messages in thread
From: Maximiliano Sandoval @ 2023-11-28 13:28 UTC (permalink / raw)
  To: pve-devel

The string `proxmox.Utils.defaultText + ' (free)'` was inlined as
`Default (Free)` cutting translatable strings makes them harder or even
impossible to translate in certain languages.

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
 www/manager6/dc/UserTagAccessEdit.js   | 10 +++++-----
 www/manager6/form/VMCPUFlagSelector.js | 24 ++++++++++++------------
 www/manager6/lxc/CreateWizard.js       |  4 ++--
 www/manager6/qemu/CreateWizard.js      |  4 ++--
 www/manager6/qemu/HDEdit.js            |  2 +-
 www/manager6/window/Settings.js        | 12 ++++++------
 6 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/www/manager6/dc/UserTagAccessEdit.js b/www/manager6/dc/UserTagAccessEdit.js
index 61c38c07..3e9a2d8e 100644
--- a/www/manager6/dc/UserTagAccessEdit.js
+++ b/www/manager6/dc/UserTagAccessEdit.js
@@ -54,11 +54,11 @@ Ext.define('PVE.dc.UserTagAccessEdit', {
 		    deleteEmpty: false,
 		    value: '__default__',
 		    comboItems: [
-			['__default__', Proxmox.Utils.defaultText + ' (free)'],
-			['free', 'free'],
-			['existing', 'existing'],
-			['list', 'list'],
-			['none', 'none'],
+			['__default__', gettext('Default (Free)')],
+			['free', gettext('Free')],
+			['existing', gettext('Existing')],
+			['list', gettext('List')],
+			['none', gettext('None')],
 		    ],
 		    defaultValue: '__default__',
 		},
diff --git a/www/manager6/form/VMCPUFlagSelector.js b/www/manager6/form/VMCPUFlagSelector.js
index ace3c531..e855b253 100644
--- a/www/manager6/form/VMCPUFlagSelector.js
+++ b/www/manager6/form/VMCPUFlagSelector.js
@@ -21,18 +21,18 @@ Ext.define('PVE.form.VMCPUFlagSelector', {
 	fields: ['flag', { name: 'state', defaultValue: '=' }, 'desc'],
 	data: [
 	    // FIXME: let qemu-server host this and autogenerate or get from API call??
-	    { flag: 'md-clear', desc: 'Required to let the guest OS know if MDS is mitigated correctly' },
-	    { flag: 'pcid', desc: 'Meltdown fix cost reduction on Westmere, Sandy-, and IvyBridge Intel CPUs' },
-	    { flag: 'spec-ctrl', desc: 'Allows improved Spectre mitigation with Intel CPUs' },
-	    { flag: 'ssbd', desc: 'Protection for "Speculative Store Bypass" for Intel models' },
-	    { flag: 'ibpb', desc: 'Allows improved Spectre mitigation with AMD CPUs' },
-	    { flag: 'virt-ssbd', desc: 'Basis for "Speculative Store Bypass" protection for AMD models' },
-	    { flag: 'amd-ssbd', desc: 'Improves Spectre mitigation performance with AMD CPUs, best used with "virt-ssbd"' },
-	    { flag: 'amd-no-ssb', desc: 'Notifies guest OS that host is not vulnerable for Spectre on AMD CPUs' },
-	    { flag: 'pdpe1gb', desc: 'Allow guest OS to use 1GB size pages, if host HW supports it' },
-	    { flag: 'hv-tlbflush', desc: 'Improve performance in overcommitted Windows guests. May lead to guest bluescreens on old CPUs.' },
-	    { flag: 'hv-evmcs', desc: 'Improve performance for nested virtualization. Only supported on Intel CPUs.' },
-	    { flag: 'aes', desc: 'Activate AES instruction set for HW acceleration.' },
+	    { flag: 'md-clear', desc: gettext('Required to let the guest OS know if MDS is mitigated correctly') },
+	    { flag: 'pcid', desc: gettext('Meltdown fix cost reduction on Westmere, Sandy-, and IvyBridge Intel CPUs') },
+	    { flag: 'spec-ctrl', desc: gettext('Allows improved Spectre mitigation with Intel CPUs') },
+	    { flag: 'ssbd', desc: gettext('Protection for "Speculative Store Bypass" for Intel models') },
+	    { flag: 'ibpb', desc: gettext('Allows improved Spectre mitigation with AMD CPUs') },
+    	    { flag: 'virt-ssbd', desc: gettext('Basis for "Speculative Store Bypass" protection for AMD models') },
+	    { flag: 'amd-ssbd', desc: gettext('Improves Spectre mitigation performance with AMD CPUs, best used with "virt-ssbd"') },
+	    { flag: 'amd-no-ssb', desc: gettext('Notifies guest OS that host is not vulnerable for Spectre on AMD CPUs') },
+	    { flag: 'pdpe1gb', desc: gettext('Allow guest OS to use 1GB size pages, if host HW supports it') },
+	    { flag: 'hv-tlbflush', desc: gettext('Improve performance in overcommitted Windows guests. May lead to guest bluescreens on old CPUs.') },
+	    { flag: 'hv-evmcs', desc: gettext('Improve performance for nested virtualization. Only supported on Intel CPUs.') },
+	    { flag: 'aes', desc: gettext('Activate AES instruction set for HW acceleration.') },
 	],
 	listeners: {
 	    update: function() {
diff --git a/www/manager6/lxc/CreateWizard.js b/www/manager6/lxc/CreateWizard.js
index b57b3050..149acd07 100644
--- a/www/manager6/lxc/CreateWizard.js
+++ b/www/manager6/lxc/CreateWizard.js
@@ -262,8 +262,8 @@ Ext.define('PVE.lxc.CreateWizard', {
 			}],
 		    },
 		    columns: [
-			{ header: 'Key', width: 150, dataIndex: 'key' },
-			{ header: 'Value', flex: 1, dataIndex: 'value' },
+			{ header: gettext('Key'), width: 150, dataIndex: 'key' },
+			{ header: gettext('Value'), flex: 1, dataIndex: 'value' },
 		    ],
 		},
 	    ],
diff --git a/www/manager6/qemu/CreateWizard.js b/www/manager6/qemu/CreateWizard.js
index 375f0c66..adf14098 100644
--- a/www/manager6/qemu/CreateWizard.js
+++ b/www/manager6/qemu/CreateWizard.js
@@ -247,8 +247,8 @@ Ext.define('PVE.qemu.CreateWizard', {
 			}],
 		    },
 		    columns: [
-			{ header: 'Key', width: 150, dataIndex: 'key' },
-			{ header: 'Value', flex: 1, dataIndex: 'value' },
+			{ header: gettext('Key'), width: 150, dataIndex: 'key' },
+			{ header: gettext('Value'), flex: 1, dataIndex: 'value' },
 		    ],
 		},
 	    ],
diff --git a/www/manager6/qemu/HDEdit.js b/www/manager6/qemu/HDEdit.js
index b78647ec..a179e92f 100644
--- a/www/manager6/qemu/HDEdit.js
+++ b/www/manager6/qemu/HDEdit.js
@@ -253,7 +253,7 @@ Ext.define('PVE.qemu.HDInputPanel', {
 	    {
 		xtype: 'proxmoxcheckbox',
 		name: 'iothread',
-		fieldLabel: 'IO thread',
+		fieldLabel: gettext('IO thread'),
 		clearOnDisable: true,
 		bind: me.insideWizard || me.isCreate ? {
 		    disabled: '{!isVirtIO && !isSCSI}',
diff --git a/www/manager6/window/Settings.js b/www/manager6/window/Settings.js
index 5cf7a70f..dbe86b71 100644
--- a/www/manager6/window/Settings.js
+++ b/www/manager6/window/Settings.js
@@ -267,9 +267,9 @@ Ext.define('PVE.window.Settings', {
 		stateId: 'guest-notes-collapse',
 		reference: 'guestNotesCollapse',
 		comboItems: [
-		    ['never', 'Show by default'],
-		    ['always', 'Collapse by default'],
-		    ['auto', 'auto (Collapse if empty)'],
+		    ['never', gettext('Show by default')],
+		    ['always', gettext('Collapse by default')],
+		    ['auto', gettext('auto (Collapse if empty)')],
 		],
 	    },
 	],
@@ -376,19 +376,19 @@ Ext.define('PVE.window.Settings', {
 				xtype: 'radiofield',
 				name: 'noVNCScalingField',
 				inputValue: 'auto',
-				boxLabel: 'Auto',
+				boxLabel: gettext('Auto'),
 			    },
 			    {
 				xtype: 'radiofield',
 				name: 'noVNCScalingField',
 				inputValue: 'scale',
-				boxLabel: 'Local Scaling',
+				boxLabel: gettext('Local Scaling'),
 				margin: '0 0 0 10',
 			    }, {
 				xtype: 'radiofield',
 				name: 'noVNCScalingField',
 				inputValue: 'off',
-				boxLabel: 'Off',
+				boxLabel: gettext('Off'),
 				margin: '0 0 0 10',
 			    },
 			],
-- 
2.39.2





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

* Re: [pve-devel] [PATCH manager] ui: mark strings translatable
  2023-11-28 13:28 [pve-devel] [PATCH manager] ui: mark strings translatable Maximiliano Sandoval
@ 2023-11-28 13:31 ` Maximiliano Sandoval
  2023-11-28 14:39 ` Dietmar Maurer
  1 sibling, 0 replies; 11+ messages in thread
From: Maximiliano Sandoval @ 2023-11-28 13:31 UTC (permalink / raw)
  To: Maximiliano Sandoval; +Cc: pve-devel


Maximiliano Sandoval <m.sandoval@proxmox.com> writes:

> +	    { flag: 'ssbd', desc: gettext('Protection for "Speculative Store Bypass" for Intel models') },
> +	    { flag: 'ibpb', desc: gettext('Allows improved Spectre mitigation with AMD CPUs') },
> +    	    { flag: 'virt-ssbd', desc: gettext('Basis for "Speculative Store Bypass" protection for AMD models') },
> +	    { flag: 'amd-ssbd', desc: gettext('Improves Spectre mitigation performance with AMD CPUs, best used with "virt-ssbd"') },
> +	    { flag: 'amd-no-ssb', desc: gettext('Notifies guest OS that host is not vulnerable for Spectre on AMD CPUs') },

Welp, indentation is broken here.


--
Maximiliano




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

* Re: [pve-devel] [PATCH manager] ui: mark strings translatable
  2023-11-28 13:28 [pve-devel] [PATCH manager] ui: mark strings translatable Maximiliano Sandoval
  2023-11-28 13:31 ` Maximiliano Sandoval
@ 2023-11-28 14:39 ` Dietmar Maurer
  2023-11-28 14:46   ` Dietmar Maurer
  1 sibling, 1 reply; 11+ messages in thread
From: Dietmar Maurer @ 2023-11-28 14:39 UTC (permalink / raw)
  To: Proxmox VE development discussion, Maximiliano Sandoval

> The string `proxmox.Utils.defaultText + ' (free)'` was inlined as
> `Default (Free)` cutting translatable strings makes them harder or even
> impossible to translate in certain languages.

Well, this also duplicates the number of things to translate!

So what languages are the problem exactly? Please can you
give me an example?




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

* Re: [pve-devel] [PATCH manager] ui: mark strings translatable
  2023-11-28 14:39 ` Dietmar Maurer
@ 2023-11-28 14:46   ` Dietmar Maurer
  2023-11-28 15:16     ` Thomas Lamprecht
  0 siblings, 1 reply; 11+ messages in thread
From: Dietmar Maurer @ 2023-11-28 14:46 UTC (permalink / raw)
  To: Proxmox VE development discussion, Maximiliano Sandoval

To be more clear, I would use:

proxmox.Utils.defaultText + ' (' + gettext('Free') + ')'


> On 28.11.2023 15:39 CET Dietmar Maurer <dietmar@proxmox.com> wrote:
> 
>  
> > The string `proxmox.Utils.defaultText + ' (free)'` was inlined as
> > `Default (Free)` cutting translatable strings makes them harder or even
> > impossible to translate in certain languages.
> 
> Well, this also duplicates the number of things to translate!
> 
> So what languages are the problem exactly? Please can you
> give me an example?
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel




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

* Re: [pve-devel] [PATCH manager] ui: mark strings translatable
  2023-11-28 14:46   ` Dietmar Maurer
@ 2023-11-28 15:16     ` Thomas Lamprecht
  2023-11-28 15:29       ` Dietmar Maurer
  2023-11-29  9:48       ` Dietmar Maurer
  0 siblings, 2 replies; 11+ messages in thread
From: Thomas Lamprecht @ 2023-11-28 15:16 UTC (permalink / raw)
  To: Proxmox VE development discussion, Dietmar Maurer, Maximiliano Sandoval

Am 28/11/2023 um 15:39 schrieb Dietmar Maurer:
> Well, this also duplicates the number of things to translate!

I'm taking on a lot of contributions to translations and the common complaint
I hear is that not all can be translated correctly due to such tricks (or just
missing gettext), most translators care much more about a correct translation
than some over-optimized ones than then break depending on context or target
language.

Also, changing this now results in only a few new strings to be translated for
those languages we get common contributions for, so not really much effort to
catch up again.

> So what languages are the problem exactly? Please can you
> give me an example?

Any right-to-left languages could be broken.

Am 28/11/2023 um 15:46 schrieb Dietmar Maurer:
> To be more clear, I would use:
> 
> proxmox.Utils.defaultText + ' (' + gettext('Free') + ')'


If, we would need to use

Ext.String.format(gettext('Default ({0})'), gettext('Free'))

But FWIW, that also drops a bit of context information (Free might be
translated different in the context of a default-value then some button
that free's something.




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

* Re: [pve-devel] [PATCH manager] ui: mark strings translatable
  2023-11-28 15:16     ` Thomas Lamprecht
@ 2023-11-28 15:29       ` Dietmar Maurer
  2023-11-28 15:44         ` Thomas Lamprecht
  2023-11-29  9:48       ` Dietmar Maurer
  1 sibling, 1 reply; 11+ messages in thread
From: Dietmar Maurer @ 2023-11-28 15:29 UTC (permalink / raw)
  To: Thomas Lamprecht, Proxmox VE development discussion,
	Maximiliano Sandoval

> I'm taking on a lot of contributions to translations and the common complaint
> I hear is that not all can be translated correctly due to such tricks (or just
> missing gettext), most translators care much more about a correct translation
> than some over-optimized ones than then break depending on context or target
> language.
> 
> Also, changing this now results in only a few new strings to be translated for
> those languages we get common contributions for, so not really much effort to
> catch up again.
> 
> > So what languages are the problem exactly? Please can you
> > give me an example?
> 
> Any right-to-left languages could be broken.

If its only right-to-left languages, we could just add another helper
to assemble lists in the correct order?




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

* Re: [pve-devel] [PATCH manager] ui: mark strings translatable
  2023-11-28 15:29       ` Dietmar Maurer
@ 2023-11-28 15:44         ` Thomas Lamprecht
  2023-11-29  8:08           ` Maximiliano Sandoval
  0 siblings, 1 reply; 11+ messages in thread
From: Thomas Lamprecht @ 2023-11-28 15:44 UTC (permalink / raw)
  To: Dietmar Maurer, Proxmox VE development discussion, Maximiliano Sandoval

Am 28/11/2023 um 16:29 schrieb Dietmar Maurer:
>> I'm taking on a lot of contributions to translations and the common complaint
>> I hear is that not all can be translated correctly due to such tricks (or just
>> missing gettext), most translators care much more about a correct translation
>> than some over-optimized ones than then break depending on context or target
>> language.
>>
>> Also, changing this now results in only a few new strings to be translated for
>> those languages we get common contributions for, so not really much effort to
>> catch up again.
>>
>>> So what languages are the problem exactly? Please can you
>>> give me an example?
>>
>> Any right-to-left languages could be broken.
> 
> If its only right-to-left languages, we could just add another helper
> to assemble lists in the correct order?

Those I'm rather sure of, but I'd not bet anything that they are the
only ones..

But as said, IMO such special helpers and optimizations are not really
worth the hassle, as most translators do not care and are happier if they
have more context and that the end result is OK, not that they have a
dozen strings, or so, less to translate..

I think the 

Ext.String.format(gettext('Default ({0})'), gettext('Free')) 

is really the biggest reuse one would get, and it needs no special new
helpers and  we have that pattern quite a few time, so IMO worth it.

btw. @Maximiliano: "Free" is rather a bad original text for the
component in question anyway, should be probably rather "Unrestricted".





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

* Re: [pve-devel] [PATCH manager] ui: mark strings translatable
  2023-11-28 15:44         ` Thomas Lamprecht
@ 2023-11-29  8:08           ` Maximiliano Sandoval
  2023-11-29  8:28             ` Thomas Lamprecht
  0 siblings, 1 reply; 11+ messages in thread
From: Maximiliano Sandoval @ 2023-11-29  8:08 UTC (permalink / raw)
  To: Thomas Lamprecht; +Cc: Dietmar Maurer, Proxmox VE development discussion


> btw. @Maximiliano: "Free" is rather a bad original text for the

Noted. Will send a v2 in a bit.

>> If its only right-to-left languages, we could just add another helper
>> to assemble lists in the correct order?

The GNOME l10n guidelines at least have an entry about not splitting
strings.

While it does not apply to this particular example, the gender of words
can be affected by words on the other side of the split.

[1] https://wiki.gnome.org/TranslationProject/DevGuidelines/Never%20split%20sentences


--
Maximiliano




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

* Re: [pve-devel] [PATCH manager] ui: mark strings translatable
  2023-11-29  8:08           ` Maximiliano Sandoval
@ 2023-11-29  8:28             ` Thomas Lamprecht
  0 siblings, 0 replies; 11+ messages in thread
From: Thomas Lamprecht @ 2023-11-29  8:28 UTC (permalink / raw)
  To: Maximiliano Sandoval; +Cc: Dietmar Maurer, Proxmox VE development discussion

Am 29/11/2023 um 09:08 schrieb Maximiliano Sandoval:
>>> If its only right-to-left languages, we could just add another helper
>>> to assemble lists in the correct order?
> 
> The GNOME l10n guidelines at least have an entry about not splitting
> strings.
> 
> While it does not apply to this particular example, the gender of words
> can be affected by words on the other side of the split.
> 
> [1] https://wiki.gnome.org/TranslationProject/DevGuidelines/Never%20split%20sentences

Fine to me to adopt as our new guideline too, in the end it makes our and
translators life simpler, as they can actually make good translations, even
if there's slightly more to translate (which never was a problem in the
first place).




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

* Re: [pve-devel] [PATCH manager] ui: mark strings translatable
  2023-11-28 15:16     ` Thomas Lamprecht
  2023-11-28 15:29       ` Dietmar Maurer
@ 2023-11-29  9:48       ` Dietmar Maurer
  2023-11-29 10:13         ` Fiona Ebner
  1 sibling, 1 reply; 11+ messages in thread
From: Dietmar Maurer @ 2023-11-29  9:48 UTC (permalink / raw)
  To: Thomas Lamprecht, Proxmox VE development discussion,
	Maximiliano Sandoval

> > So what languages are the problem exactly? Please can you
> > give me an example?
> 
> Any right-to-left languages could be broken.

This is not really true. RTL languages just render string in the other direction, so string concatenation still works as expected.

> 
> Am 28/11/2023 um 15:46 schrieb Dietmar Maurer:
> > To be more clear, I would use:
> > 
> > proxmox.Utils.defaultText + ' (' + gettext('Free') + ')'




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

* Re: [pve-devel] [PATCH manager] ui: mark strings translatable
  2023-11-29  9:48       ` Dietmar Maurer
@ 2023-11-29 10:13         ` Fiona Ebner
  0 siblings, 0 replies; 11+ messages in thread
From: Fiona Ebner @ 2023-11-29 10:13 UTC (permalink / raw)
  To: Proxmox VE development discussion, Dietmar Maurer,
	Thomas Lamprecht, Maximiliano Sandoval

Am 29.11.23 um 10:48 schrieb Dietmar Maurer:
>>> So what languages are the problem exactly? Please can you
>>> give me an example?
>>
>> Any right-to-left languages could be broken.
> 
> This is not really true. RTL languages just render string in the other direction, so string concatenation still works as expected.
> 

Not all languages use the same word order to express the same meaning,
so concatenation is still wrong.

Consider
"I tried the new product"
and suppose you want to split it
"I tried" + "the new product"

This will not work for Japanese, because the verb will come last.




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

end of thread, other threads:[~2023-11-29 10:13 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-28 13:28 [pve-devel] [PATCH manager] ui: mark strings translatable Maximiliano Sandoval
2023-11-28 13:31 ` Maximiliano Sandoval
2023-11-28 14:39 ` Dietmar Maurer
2023-11-28 14:46   ` Dietmar Maurer
2023-11-28 15:16     ` Thomas Lamprecht
2023-11-28 15:29       ` Dietmar Maurer
2023-11-28 15:44         ` Thomas Lamprecht
2023-11-29  8:08           ` Maximiliano Sandoval
2023-11-29  8:28             ` Thomas Lamprecht
2023-11-29  9:48       ` Dietmar Maurer
2023-11-29 10:13         ` Fiona Ebner

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