Browse Source
* ab/i18n-basic: i18n: "make distclean" should clean up after "make pot" i18n: Makefile: "pot" target to extract messages marked for translation i18n: add stub Q_() wrapper for ngettext i18n: do not poison translations unless GIT_GETTEXT_POISON envvar is set i18n: add GETTEXT_POISON to simulate unfriendly translator i18n: add no-op _() and N_() wrappers commit, status: use status_printf{,_ln,_more} helpers commit: refer to commit template as s->fp wt-status: add helpers for printing wt-status lines Conflicts: builtin/commit.cmaint
Junio C Hamano
14 years ago
6 changed files with 93 additions and 0 deletions
@ -0,0 +1,14 @@ |
|||||||
|
/* |
||||||
|
* Copyright (c) 2010 Ævar Arnfjörð Bjarmason |
||||||
|
*/ |
||||||
|
|
||||||
|
#include "git-compat-util.h" |
||||||
|
#include "gettext.h" |
||||||
|
|
||||||
|
int use_gettext_poison(void) |
||||||
|
{ |
||||||
|
static int poison_requested = -1; |
||||||
|
if (poison_requested == -1) |
||||||
|
poison_requested = getenv("GIT_GETTEXT_POISON") ? 1 : 0; |
||||||
|
return poison_requested; |
||||||
|
} |
@ -0,0 +1,40 @@ |
|||||||
|
/* |
||||||
|
* Copyright (c) 2010-2011 Ævar Arnfjörð Bjarmason |
||||||
|
* |
||||||
|
* This is a skeleton no-op implementation of gettext for Git. |
||||||
|
* You can replace it with something that uses libintl.h and wraps |
||||||
|
* gettext() to try out the translations. |
||||||
|
*/ |
||||||
|
|
||||||
|
#ifndef GETTEXT_H |
||||||
|
#define GETTEXT_H |
||||||
|
|
||||||
|
#if defined(_) || defined(Q_) |
||||||
|
#error "namespace conflict: '_' or 'Q_' is pre-defined?" |
||||||
|
#endif |
||||||
|
|
||||||
|
#define FORMAT_PRESERVING(n) __attribute__((format_arg(n))) |
||||||
|
|
||||||
|
#ifdef GETTEXT_POISON |
||||||
|
extern int use_gettext_poison(void); |
||||||
|
#else |
||||||
|
#define use_gettext_poison() 0 |
||||||
|
#endif |
||||||
|
|
||||||
|
static inline FORMAT_PRESERVING(1) const char *_(const char *msgid) |
||||||
|
{ |
||||||
|
return use_gettext_poison() ? "# GETTEXT POISON #" : msgid; |
||||||
|
} |
||||||
|
|
||||||
|
static inline FORMAT_PRESERVING(1) FORMAT_PRESERVING(2) |
||||||
|
const char *Q_(const char *msgid, const char *plu, unsigned long n) |
||||||
|
{ |
||||||
|
if (use_gettext_poison()) |
||||||
|
return "# GETTEXT POISON #"; |
||||||
|
return n == 1 ? msgid : plu; |
||||||
|
} |
||||||
|
|
||||||
|
/* Mark msgid for translation but do not translate it. */ |
||||||
|
#define N_(msgid) (msgid) |
||||||
|
|
||||||
|
#endif |
Loading…
Reference in new issue