From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 055081FF138 for ; Wed, 04 Feb 2026 14:43:20 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 7AC9114820; Wed, 4 Feb 2026 14:43:50 +0100 (CET) From: Maximiliano Sandoval To: pve-devel@lists.proxmox.com Subject: Re: [PATCH proxmox-i18n 2/2] fix strings with wrong format In-Reply-To: <20260204104150.178904-2-m.sandoval@proxmox.com> (Maximiliano Sandoval's message of "Wed, 4 Feb 2026 11:41:35 +0100") References: <20260204104150.178904-1-m.sandoval@proxmox.com> <20260204104150.178904-2-m.sandoval@proxmox.com> User-Agent: mu4e 1.12.9; emacs 30.1 Date: Wed, 04 Feb 2026 14:43:14 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1770212518198 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.087 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 KAM_SHORT 0.001 Use of a URL Shortener for very short URL 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 Message-ID-Hash: EX3YLCCSBP3BPO2JZT4VQDJG46CDGTNS X-Message-ID-Hash: EX3YLCCSBP3BPO2JZT4VQDJG46CDGTNS X-MailFrom: m.sandoval@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Maximiliano Sandoval writes: > That would fail to be replaced at runtime. Depending on how the string > was replaced at runtime having a broken format can result in either the > string not being replaced at runtime or a crash. > > Where it was not clear how to fix the issue the string is left > untranslated. > > After this commit the remaining errors are only in ukr.po, ru.po and a > single error in pl.po that can be fixed with [2]. The reported errors in > ukr.po and ru.po need more consideration due to the complexity of their > plural forms. > > These were detected with the following script > > ```python > import polib > from pathlib import Path > > dirty = False > > def is_rust_format(entry): > return ( > "{}" in entry.msgid > or "{0}" in entry.msgid > or "{n}" in entry.msgid > or "{}" in entry.msgid_plural > or "{0}" in entry.msgid_plural > or "{n}" in entry.msgid_plural > ) > > def check_po_file(path): > po = polib.pofile(path) > for entry in po: > if "javascript-format" in entry.flags: > entry.flags.remove("javascript-format") > > if ( > entry.occurrences > and all([o.endswith(".rs") for (o, l) in entry.occurrences]) > and is_rust_format(entry) > ): > entry.flags.append("rust-format") > dirty = True > > if dirty: > po.save(f"{file.stem}.with-formats.po") > > root = Path() > > for file in root.iterdir(): > if file.suffix == ".po" and ".with-formats" not in file.name: > check_po_file(file) > ``` > > which attaches the `rust-format` flag to a string. Then later the new po > files are checked with > ``` > msgfmt --check $PO_FILE > ``` > > with gettext 0.26. This can be done, for example, with > ```sh > for f in *.with-formats.po; do flatpak run --command=msgfmt --filesystem=home org.freedesktop.Platform//25.08 --check $f; done > ``` > > for example. > > [1] https://www.gnu.org/software/gettext/manual/html_node/Plural-forms.html#index-ngettext > [2] https://lore.proxmox.com/all/20260204100736.134697-1-m.sandoval@proxmox.com/ > > Signed-off-by: Maximiliano Sandoval I found more issues on strings consumed by js. I will send v2 in a bit. -- Maximiliano