public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH manager v1] add default pgettext/npgettext implementations to index.html.tpl
@ 2026-02-28  6:03 Kefu Chai
  2026-03-10  9:18 ` Kefu Chai
  0 siblings, 1 reply; 2+ messages in thread
From: Kefu Chai @ 2026-02-28  6:03 UTC (permalink / raw)
  To: pve-devel

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>
---
 www/index.html.tpl | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/www/index.html.tpl b/www/index.html.tpl
index 0c289bbe..74ee02d9 100644
--- a/www/index.html.tpl
+++ b/www/index.html.tpl
@@ -27,6 +27,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] 2+ messages in thread

* Re: [PATCH manager v1] add default pgettext/npgettext implementations to index.html.tpl
  2026-02-28  6:03 [PATCH manager v1] add default pgettext/npgettext implementations to index.html.tpl Kefu Chai
@ 2026-03-10  9:18 ` Kefu Chai
  0 siblings, 0 replies; 2+ messages in thread
From: Kefu Chai @ 2026-03-10  9:18 UTC (permalink / raw)
  To: Thomas Lamprecht, Kefu Chai, pve-devel

Hi Thomas,

Could help review this change as well? It's similar to the other changes
adding default implementations for the gettext() variant functions.
Without these changes, we would not be able to introduce them to the 
proxmox-i18n project.

cheers,

On Sat Feb 28, 2026 at 2:03 PM CST, Kefu Chai wrote:
> 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>
> ---
>  www/index.html.tpl | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/www/index.html.tpl b/www/index.html.tpl
> index 0c289bbe..74ee02d9 100644
> --- a/www/index.html.tpl
> +++ b/www/index.html.tpl
> @@ -27,6 +27,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 %]





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

end of thread, other threads:[~2026-03-10  9:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-28  6:03 [PATCH manager v1] add default pgettext/npgettext implementations to index.html.tpl Kefu Chai
2026-03-10  9:18 ` Kefu Chai

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