[vlc-devel] [PATCH 1/5] macosx: add macro for contextualized translation strings
Marvin Scholz
epirat07 at gmail.com
Wed Dec 2 13:59:46 CET 2020
---
modules/gui/macosx/extensions/NSString+Helpers.h | 10 ++++++++++
po/Makevars | 2 +-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/modules/gui/macosx/extensions/NSString+Helpers.h b/modules/gui/macosx/extensions/NSString+Helpers.h
index 1234747294d..79416d14116 100644
--- a/modules/gui/macosx/extensions/NSString+Helpers.h
+++ b/modules/gui/macosx/extensions/NSString+Helpers.h
@@ -30,6 +30,16 @@
#define _NS(s) ((s) ? toNSStr(vlc_gettext(s)) : @"")
+/**
+ * Get a contextualized translation string
+ *
+ * Sometimes a translations needs to be unique to a specific context
+ * even though it has the same ID (text) as a different translation.
+ * In this case, this macro should be used with a unique translation
+ * context as the first argument.
+ */
+#define _PNS(c, s) (toNSStr(vlc_pgettext(c, s)))
+
/* Get an alternate version of the string.
* This string is stored as '1:string' but when displayed it only displays
* the translated string. the translation should be '1:translatedstring' though */
diff --git a/po/Makevars b/po/Makevars
index 8eed7d620d6..3883c0349e5 100644
--- a/po/Makevars
+++ b/po/Makevars
@@ -10,7 +10,7 @@ subdir = po
top_builddir = ..
# These options get passed to xgettext.
-XGETTEXT_OPTIONS = --directory=.. --keyword=_ --keyword=N_ --keyword=_NS --keyword=_ANS --keyword=qtr --keyword=Q_ --language=C++ --keyword=vlc_ngettext:1,2 --keyword=vlc_pgettext:1c,2 --add-comments=xgettext: --from-code=UTF-8
+XGETTEXT_OPTIONS = --directory=.. --keyword=_ --keyword=N_ --keyword=_NS --keyword=_ANS --keyword=qtr --keyword=Q_ --language=C++ --keyword=vlc_ngettext:1,2 --keyword=vlc_pgettext:1c,2 --keyword=_PNS:1c,2 --add-comments=xgettext: --from-code=UTF-8
# This is the copyright holder that gets inserted into the header of the
# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
--
2.24.3 (Apple Git-128)
More information about the vlc-devel
mailing list