From: Kefu Chai <[email protected]>

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 <[email protected]>
---
 www/index.hbs | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/www/index.hbs b/www/index.hbs
index e9cc0e37..536cbd1c 100644
--- a/www/index.hbs
+++ b/www/index.hbs
@@ -25,6 +25,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>
     {{/if}}
     {{#if debug}}
-- 
2.47.3




Reply via email to