Skip to content

Commit

Permalink
Add support for pgettext()
Browse files Browse the repository at this point in the history
Primarily gives it a shorthand, but also make gcc tolerate its
use for format strings.
  • Loading branch information
CendioOssman committed Sep 23, 2015
1 parent 551a6cb commit e73b475
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions po/CMakeLists.txt
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions vncviewer/i18n.h
Expand Up @@ -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 */

0 comments on commit e73b475

Please sign in to comment.