summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2015-09-23 16:38:17 +0200
committerPierre Ossman <ossman@cendio.se>2015-09-23 16:38:17 +0200
commite73b47570e57cf867d84fbac76218e7e611757bf (patch)
treec5c3f877d67aaf0ee9f3f494e05fdcc3e5585a2a
parent551a6cbe68b1000f0dd5c020221a45bb8dd1938d (diff)
downloadtigervnc-e73b47570e57cf867d84fbac76218e7e611757bf.tar.gz
tigervnc-e73b47570e57cf867d84fbac76218e7e611757bf.zip
Add support for pgettext()
Primarily gives it a shorthand, but also make gcc tolerate its use for format strings.
-rw-r--r--po/CMakeLists.txt1
-rw-r--r--vncviewer/i18n.h9
2 files changed, 10 insertions, 0 deletions
diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt
index e3b2ca2e..6f29fe15 100644
--- a/po/CMakeLists.txt
+++ b/po/CMakeLists.txt
@@ -23,6 +23,7 @@ if (GETTEXT_XGETTEXT_EXECUTABLE)
"--output=${CMAKE_CURRENT_SOURCE_DIR}/tigervnc.pot"
--default-domain=tigervnc
--keyword=_
+ --keyword=p_:1c,2
--keyword=N_
"--copyright-holder=TigerVNC Team and many others \(see README.txt\)"
--msgid-bugs-address=tigervnc-devel@googlegroups.com
diff --git a/vncviewer/i18n.h b/vncviewer/i18n.h
index 0ce9e1bf..ee0e020d 100644
--- a/vncviewer/i18n.h
+++ b/vncviewer/i18n.h
@@ -22,7 +22,16 @@
#include "gettext.h"
+/* Need to tell gcc that pgettext() doesn't screw up format strings */
+#ifdef __GNUC__
+static const char *
+pgettext_aux (const char *domain,
+ const char *msg_ctxt_id, const char *msgid,
+ int category) __attribute__ ((format_arg (3)));
+#endif
+
#define _(String) gettext (String)
+#define p_(Context, String) pgettext (Context, String)
#define N_(String) gettext_noop (String)
#endif /* _I18N_H */