From: Maximiliano Sandoval <m.sandoval@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH widget-toolkit 1/1] utils: use ngettext for number of CPUs
Date: Wed, 28 Jan 2026 09:56:11 +0100 [thread overview]
Message-ID: <20260128085614.91769-1-m.sandoval@proxmox.com> (raw)
Note that it is up to the translator to translate the singular using
{1}, for example one could translate it as "{0}% of one CPU" in British
English.
The string will be extracted as:
```
#. TRANSLATORS: For example "5% of 24 CPUs"
#: proxmox-widget-toolkit/src/Utils.js:1123
#, javascript-format
msgid "{0}% of {1} CPU"
msgid_plural "{0}% of {1} CPUs"
msgstr[0] "{0}% de {1} CPU"
msgstr[1] "{0}% de {1} CPUs"
```
xgettext has some understanding of javascript and mistakenly thinks that
'%' will reference a variable, hence the javascript-format hint, but
this is a pre-existing issue.
[1] https://www.gnu.org/software/gettext/manual/html_node/javascript_002dformat.html
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
src/Utils.js | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/Utils.js b/src/Utils.js
index 5457ffa..ed51ce5 100644
--- a/src/Utils.js
+++ b/src/Utils.js
@@ -1118,7 +1118,8 @@ Ext.define('Proxmox.Utils', {
render_cpu_usage: function (val, max) {
return Ext.String.format(
- `${gettext('{0}% of {1}')} ${gettext('CPU(s)')}`,
+ // TRANSLATORS: For example "5% of 24 CPUs"
+ ngettext('{0}% of {1} CPU', '{0}% of {1} CPUs', max),
(val * 100).toFixed(2),
max,
);
--
2.47.3
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next reply other threads:[~2026-01-28 8:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-28 8:56 Maximiliano Sandoval [this message]
2026-01-28 8:56 ` [pve-devel] [PATCH proxmox-datacenter-manager 1/1] use ngettext for the " Maximiliano Sandoval
2026-01-28 9:29 ` [pve-devel] [PATCH widget-toolkit 1/1] utils: use ngettext for " Maximiliano Sandoval
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260128085614.91769-1-m.sandoval@proxmox.com \
--to=m.sandoval@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.