public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Kefu Chai" <k.chai@proxmox.com>
To: "Thomas Lamprecht" <t.lamprecht@proxmox.com>,
	"Kefu Chai" <k.chai@proxmox.com>, <pve-devel@lists.proxmox.com>
Cc: Kefu Chai <tchaikov@gmail.com>
Subject: Re: [PATCH pmg-gui] add default pgettext/npgettext implementations to pmg-index.html.tt
Date: Tue, 10 Mar 2026 16:51:45 +0800	[thread overview]
Message-ID: <DGYZ33SWABWK.3QYKXJI1RJPR6@proxmox.com> (raw)
In-Reply-To: <20260228060757.3271160-1-k.chai@proxmox.com>

Hi Thomas,

Could you please help review this change? It is one of the changes to
prepare us for the context-aware translation support. After all these
change land, we will update proxmox-i18n to add support for pgettext()
and npgettext().

cheers,

On Sat Feb 28, 2026 at 2:07 PM CST, Kefu Chai wrote:
> 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 %]





      reply	other threads:[~2026-03-10  8:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-28  6:07 Kefu Chai
2026-03-10  8:51 ` Kefu Chai [this message]

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=DGYZ33SWABWK.3QYKXJI1RJPR6@proxmox.com \
    --to=k.chai@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    --cc=t.lamprecht@proxmox.com \
    --cc=tchaikov@gmail.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 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