зеркало из https://github.com/microsoft/git.git
Merge branch 'ab/i18n-basic'
* 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.c
This commit is contained in:
Коммит
1e239079f7
28
Makefile
28
Makefile
|
@ -216,6 +216,11 @@ all::
|
|||
#
|
||||
# Define NO_REGEX if you have no or inferior regex support in your C library.
|
||||
#
|
||||
# Define GETTEXT_POISON if you are debugging the choice of strings marked
|
||||
# for translation. In a GETTEXT_POISON build, you can turn all strings marked
|
||||
# for translation into gibberish by setting the GIT_GETTEXT_POISON variable
|
||||
# (to any value) in your environment.
|
||||
#
|
||||
# Define JSMIN to point to JavaScript minifier that functions as
|
||||
# a filter to have gitweb.js minified.
|
||||
#
|
||||
|
@ -316,6 +321,7 @@ INSTALL = install
|
|||
RPMBUILD = rpmbuild
|
||||
TCL_PATH = tclsh
|
||||
TCLTK_PATH = wish
|
||||
XGETTEXT = xgettext
|
||||
PTHREAD_LIBS = -lpthread
|
||||
PTHREAD_CFLAGS =
|
||||
GCOV = gcov
|
||||
|
@ -515,6 +521,7 @@ LIB_H += diff.h
|
|||
LIB_H += dir.h
|
||||
LIB_H += exec_cmd.h
|
||||
LIB_H += fsck.h
|
||||
LIB_H += gettext.h
|
||||
LIB_H += git-compat-util.h
|
||||
LIB_H += graph.h
|
||||
LIB_H += grep.h
|
||||
|
@ -1370,6 +1377,10 @@ endif
|
|||
ifdef NO_SYMLINK_HEAD
|
||||
BASIC_CFLAGS += -DNO_SYMLINK_HEAD
|
||||
endif
|
||||
ifdef GETTEXT_POISON
|
||||
LIB_OBJS += gettext.o
|
||||
BASIC_CFLAGS += -DGETTEXT_POISON
|
||||
endif
|
||||
ifdef NO_STRCASESTR
|
||||
COMPAT_CFLAGS += -DNO_STRCASESTR
|
||||
COMPAT_OBJS += compat/strcasestr.o
|
||||
|
@ -1581,6 +1592,7 @@ ifndef V
|
|||
QUIET_BUILT_IN = @echo ' ' BUILTIN $@;
|
||||
QUIET_GEN = @echo ' ' GEN $@;
|
||||
QUIET_LNCP = @echo ' ' LN/CP $@;
|
||||
QUIET_XGETTEXT = @echo ' ' XGETTEXT $@;
|
||||
QUIET_GCOV = @echo ' ' GCOV $@;
|
||||
QUIET_SUBDIR0 = +@subdir=
|
||||
QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \
|
||||
|
@ -2048,6 +2060,20 @@ info:
|
|||
pdf:
|
||||
$(MAKE) -C Documentation pdf
|
||||
|
||||
XGETTEXT_FLAGS = \
|
||||
--force-po \
|
||||
--add-comments \
|
||||
--msgid-bugs-address="Git Mailing List <git@vger.kernel.org>" \
|
||||
--from-code=UTF-8
|
||||
XGETTEXT_FLAGS_C = $(XGETTEXT_FLAGS) --keyword=_ --keyword=N_ --language=C
|
||||
LOCALIZED_C := $(C_OBJ:o=c)
|
||||
|
||||
po/git.pot: $(LOCALIZED_C)
|
||||
$(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ $(XGETTEXT_FLAGS_C) $(LOCALIZED_C) && \
|
||||
mv $@+ $@
|
||||
|
||||
pot: po/git.pot
|
||||
|
||||
$(ETAGS_TARGET): FORCE
|
||||
$(RM) $(ETAGS_TARGET)
|
||||
$(FIND) . -name '*.[hcS]' -print | xargs etags -a -o $(ETAGS_TARGET)
|
||||
|
@ -2089,6 +2115,7 @@ endif
|
|||
ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT
|
||||
@echo GIT_TEST_CMP_USE_COPIED_CONTEXT=YesPlease >>$@
|
||||
endif
|
||||
@echo GETTEXT_POISON=\''$(subst ','\'',$(subst ','\'',$(GETTEXT_POISON)))'\' >>$@
|
||||
|
||||
### Detect Tck/Tk interpreter path changes
|
||||
ifndef NO_TCLTK
|
||||
|
@ -2314,6 +2341,7 @@ dist-doc:
|
|||
|
||||
distclean: clean
|
||||
$(RM) configure
|
||||
$(RM) po/git.pot
|
||||
|
||||
clean:
|
||||
$(RM) *.o block-sha1/*.o ppc/*.o compat/*.o compat/*/*.o xdiff/*.o vcs-svn/*.o \
|
||||
|
|
1
cache.h
1
cache.h
|
@ -5,6 +5,7 @@
|
|||
#include "strbuf.h"
|
||||
#include "hash.h"
|
||||
#include "advice.h"
|
||||
#include "gettext.h"
|
||||
|
||||
#include SHA1_HEADER
|
||||
#ifndef git_SHA_CTX
|
||||
|
|
|
@ -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
|
|
@ -0,0 +1 @@
|
|||
/git.pot
|
|
@ -1079,6 +1079,15 @@ esac
|
|||
test -z "$NO_PERL" && test_set_prereq PERL
|
||||
test -z "$NO_PYTHON" && test_set_prereq PYTHON
|
||||
|
||||
# Can we rely on git's output in the C locale?
|
||||
if test -n "$GETTEXT_POISON"
|
||||
then
|
||||
GIT_GETTEXT_POISON=YesPlease
|
||||
export GIT_GETTEXT_POISON
|
||||
else
|
||||
test_set_prereq C_LOCALE_OUTPUT
|
||||
fi
|
||||
|
||||
# test whether the filesystem supports symbolic links
|
||||
ln -s x y 2>/dev/null && test -h y 2>/dev/null && test_set_prereq SYMLINKS
|
||||
rm -f y
|
||||
|
|
Загрузка…
Ссылка в новой задаче