all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH pmg-gui] add default pgettext/npgettext implementations to pmg-index.html.tt
@ 2026-02-28  6:07 Kefu Chai
  0 siblings, 0 replies; only message in thread
From: Kefu Chai @ 2026-02-28  6:07 UTC (permalink / raw)
  To: pve-devel; +Cc: Kefu Chai

From: Kefu Chai <tchaikov@gmail.com>

This adds default implementations for pgettext() and npgettext() functions
to prevent UI breakage when no language is selected.

These functions are required for context-aware translations support added
to the proxmox-i18n tooling.

Default implementations:
- pgettext(context, message): Returns message (ignores context)
- npgettext(context, singular, plural, count): Returns appropriate form

When a language file is loaded, these defaults are replaced by the actual
translation functions from the i18n catalog.

Signed-off-by: Kefu Chai <k.chai@proxmox.com>
---
 pmg-index.html.tt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/pmg-index.html.tt b/pmg-index.html.tt
index 42a483a..10f9a2d 100644
--- a/pmg-index.html.tt
+++ b/pmg-index.html.tt
@@ -26,6 +26,8 @@
     <script type='text/javascript'>
         function gettext(message) { return message; }
         function ngettext(singular, plural, count) { return count === 1 ? singular : plural; }
+        function pgettext(context, message) { return message; }
+        function npgettext(context, singular, plural, count) { return count === 1 ? singular : plural; }
     </script>
     [%- END %]
     [% IF debug %]
-- 
2.47.3





^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-02-28  6:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-28  6:07 [PATCH pmg-gui] add default pgettext/npgettext implementations to pmg-index.html.tt Kefu Chai

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.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal