Gettext poison rework
cover Gettext poison rework
Still WIP but I'm getting closer. I dropped test-poisongen and started to use podebug [2] instead. Less code in git. podebug does not preserve shell variables yet. I'll follow that up at upstream [1].
With this series, if you have translation toolkit installed, you could do
make pseudo-locale L=<your language code>
make GETTEXT_POISON=$LANG test
podebug supports a few way of rewriting translations. Currently "unicode" is used but you can change it via PODEBUG_OPTS
t9001 is not happy with $LANG != C though. May need to add some prereq there.
[1] http://bugs.locamotion.org/show_bug.cgi?id=2450
[2] http://translate.sourceforge.net/wiki/toolkit/podebug
Nguyễn Thái Ngọc Duy (6):
Makefile: do not mark strings for l10n from test programs
Makefile: recreate git.pot if *.sh or *.perl changes Replace gettext poison implementation with pseudotranslation
generation
Initialize gettext for test programs that may use it Support logging unmarked strings
test-parse-options: mark parseopt help strings for pseudotranslation
.gitignore | 1 + Makefile | 48 +++++++++++++++++++++--------------- gettext.c | 10 -------- gettext.h | 10 +------- git-sh-i18n.sh | 14 ----------- po/.gitignore | 1 + po/README | 15 +++++------ t/.gitignore | 1 + t/lib-gettext.sh | 7 +++++- t/t0200-gettext-basic.sh | 1 + t/t0205-gettext-poison.sh | 36 --------------------------- t/test-lib.sh | 2 +- test-date.c | 1 + test-delta.c | 1 + test-dump-cache-tree.c | 5 +++- test-index-version.c | 1 + test-match-trees.c | 1 + test-mergesort.c | 1 + test-parse-options.c | 63 ++++++++++++++++++++++++----------------------- test-path-utils.c | 1 + test-revision-walking.c | 1 + test-scrap-cache-tree.c | 4 ++- test-sha1.c | 1 + test-subprocess.c | 1 + wrap-for-bin.sh | 16 +++++++++++- 25 files changed, 111 insertions(+), 132 deletions(-) delete mode 100755 t/t0205-gettext-poison.sh
Signature · 1 line
1.7.12.rc2
PATCH 1/6 Makefile: do not mark strings for l10n from test programs
--- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Makefile +2 -1
@@ -2398,7 +2398,8 @@ XGETTEXT_FLAGS_C = $(XGETTEXT_FLAGS) --language=C \ XGETTEXT_FLAGS_SH = $(XGETTEXT_FLAGS) --language=Shell \ --keyword=gettextln --keyword=eval_gettextln XGETTEXT_FLAGS_PERL = $(XGETTEXT_FLAGS) --keyword=__ --language=Perl -LOCALIZED_C := $(C_OBJ:o=c) $(LIB_H) $(GENERATED_H) +C_OBJ_NOTESTS:= $(filter-out test-%,$(C_OBJ)) +LOCALIZED_C := $(C_OBJ_NOTESTS:o=c) $(LIB_H) $(GENERATED_H) LOCALIZED_SH := $(SCRIPT_SH) LOCALIZED_PERL := $(SCRIPT_PERL)
Signature · 1 line
1.7.12.rc2
PATCH 2/6 Makefile: recreate git.pot if *.sh or *.perl changes
In reply to Nguyễn Thái Ngọc Duy--- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
@@ -2409,7 +2409,7 @@ LOCALIZED_SH += t/t0200/test.sh LOCALIZED_PERL += t/t0200/test.perl endif -po/git.pot: $(LOCALIZED_C) +po/git.pot: $(LOCALIZED_C) $(LOCALIZED_SH) $(LOCALIZED_PERL) $(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ $(XGETTEXT_FLAGS_C) $(LOCALIZED_C) $(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ --join-existing $(XGETTEXT_FLAGS_SH) \ $(LOCALIZED_SH)
Signature · 1 line
1.7.12.rc2
PATCH 3/6 Replace gettext poison implementation with pseudotranslation generation
In reply to Nguyễn Thái Ngọc Duy--- Makefile | 45 ++++++++++++++++++++++++++------------------- gettext.c | 10 ---------- gettext.h | 10 +--------- git-sh-i18n.sh | 14 -------------- po/.gitignore | 1 + po/README | 15 ++++++++------- t/.gitignore | 1 + t/lib-gettext.sh | 7 ++++++- t/t0200-gettext-basic.sh | 1 + t/t0205-gettext-poison.sh | 36 ------------------------------------ t/test-lib.sh | 2 +- wrap-for-bin.sh | 10 +++++++++- 12 files changed, 54 insertions(+), 98 deletions(-) delete mode 100755 t/t0205-gettext-poison.sh
Makefile +26 -19
@@ -258,11 +258,6 @@ all:: # Define HAVE_DEV_TTY if your system can open /dev/tty to interact with the # user. # -# 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. #
@@ -376,6 +371,8 @@ MSGFMT = msgfmt PTHREAD_LIBS = -lpthread PTHREAD_CFLAGS = GCOV = gcov +PODEBUG = podebug +PODEBUG_OPTS = --rewrite=unicode export TCL_PATH TCLTK_PATH
@@ -1594,9 +1591,6 @@ endif ifdef NO_SYMLINK_HEAD BASIC_CFLAGS += -DNO_SYMLINK_HEAD endif -ifdef GETTEXT_POISON - BASIC_CFLAGS += -DGETTEXT_POISON -endif ifdef NO_GETTEXT BASIC_CFLAGS += -DNO_GETTEXT USE_GETTEXT_SCHEME ?= fallthrough
@@ -2403,19 +2397,28 @@ LOCALIZED_C := $(C_OBJ_NOTESTS:o=c) $(LIB_H) $(GENERATED_H) LOCALIZED_SH := $(SCRIPT_SH) LOCALIZED_PERL := $(SCRIPT_PERL) -ifdef XGETTEXT_INCLUDE_TESTS -LOCALIZED_C += t/t0200/test.c -LOCALIZED_SH += t/t0200/test.sh -LOCALIZED_PERL += t/t0200/test.perl -endif +LOCALIZED_C_TESTS += t/t0200/test.c $(TEST_OBJS:o=c) +LOCALIZED_SH_TESTS += t/t0200/test.sh +LOCALIZED_PERL_TESTS += t/t0200/test.perl -po/git.pot: $(LOCALIZED_C) $(LOCALIZED_SH) $(LOCALIZED_PERL) - $(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ $(XGETTEXT_FLAGS_C) $(LOCALIZED_C) - $(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ --join-existing $(XGETTEXT_FLAGS_SH) \ +po/git.pot+: $(LOCALIZED_C) $(LOCALIZED_SH) $(LOCALIZED_PERL) + $(QUIET_XGETTEXT)$(XGETTEXT) -o$@ $(XGETTEXT_FLAGS_C) $(LOCALIZED_C) + $(QUIET_XGETTEXT)$(XGETTEXT) -o$@ --join-existing $(XGETTEXT_FLAGS_SH) \ $(LOCALIZED_SH) - $(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ --join-existing $(XGETTEXT_FLAGS_PERL) \ + $(QUIET_XGETTEXT)$(XGETTEXT) -o$@ --join-existing $(XGETTEXT_FLAGS_PERL) \ $(LOCALIZED_PERL) - mv $@+ $@ + +po/git.pot: po/git.pot+ + mv $< $@ + +t/test.po: po/git.pot+ $(LOCALIZED_C_TESTS) $(LOCALIZED_SH_TESTS) $(LOCALIZED_PERL_TESTS) + cp $< $@t + $(QUIET_XGETTEXT)$(XGETTEXT) -o$@t --join-existing $(XGETTEXT_FLAGS_C) $(LOCALIZED_C_TESTS) + $(QUIET_XGETTEXT)$(XGETTEXT) -o$@t --join-existing $(XGETTEXT_FLAGS_SH) \ + $(LOCALIZED_SH_TESTS) + $(QUIET_XGETTEXT)$(XGETTEXT) -o$@t --join-existing $(XGETTEXT_FLAGS_PERL) \ + $(LOCALIZED_PERL_TESTS) + $(PODEBUG) $(PODEBUG_OPTS) $@t -o $@ pot: po/git.pot
@@ -2429,6 +2432,11 @@ endif po/build/locale/%/LC_MESSAGES/git.mo: po/%.po $(QUIET_MSGFMT)mkdir -p $(dir $@) && $(MSGFMT) -o $@ $< +po/build/pseudo-locale/$(L)/LC_MESSAGES/git.mo: t/test.po + $(QUIET_MSGFMT)mkdir -p $(dir $@) && $(MSGFMT) -o $@ $< + +pseudo-locale: po/build/pseudo-locale/$(L)/LC_MESSAGES/git.mo + FIND_SOURCE_FILES = ( git ls-files '*.[hcS]' 2>/dev/null || \ $(FIND) . \( -name .git -type d -prune \) \ -o \( -name '*.[hcS]' -type f -print \) )
@@ -2498,7 +2506,6 @@ ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT @echo GIT_TEST_CMP_USE_COPIED_CONTEXT=YesPlease >>$@ endif @echo NO_GETTEXT=\''$(subst ','\'',$(subst ','\'',$(NO_GETTEXT)))'\' >>$@ - @echo GETTEXT_POISON=\''$(subst ','\'',$(subst ','\'',$(GETTEXT_POISON)))'\' >>$@ ifdef GIT_PERF_REPEAT_COUNT @echo GIT_PERF_REPEAT_COUNT=\''$(subst ','\'',$(subst ','\'',$(GIT_PERF_REPEAT_COUNT)))'\' >>$@ endif
gettext.c +0 -10
@@ -16,16 +16,6 @@# endif #endif -#ifdef GETTEXT_POISON -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; -} -#endif -#ifndef NO_GETTEXT static void init_gettext_charset (const char *domain) {
gettext.h +1 -9
@@ -36,22 +36,14 @@ static inline void git_setup_gettext(void) }#endif -#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 #" : gettext(msgid); + return gettext(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 ngettext (msgid, plu, n); }
git-sh-i18n.sh +0 -14
@@ -24,9 +24,6 @@ then elif test -n "$GIT_INTERNAL_GETTEXT_TEST_FALLBACKS" then : no probing necessary -elif test -n "$GIT_GETTEXT_POISON" -then - GIT_INTERNAL_GETTEXT_SH_SCHEME=poison elif type gettext.sh >/dev/null 2>&1 then # GNU libintl's gettext.sh
@@ -55,17 +52,6 @@ gettext_without_eval_gettext) ) } ;; -poison) - # Emit garbage so that tests that incorrectly rely on translatable - # strings will fail. - gettext () { - printf "%s" "# GETTEXT POISON #" - } - - eval_gettext () { - printf "%s" "# GETTEXT POISON #" - } - ;; *) gettext () { printf "%s" "$1"
po/.gitignore +1 -0
@@ -1 +1,2 @@ /build +/git.pot+
po/README +8 -7
@@ -270,16 +270,15 @@ something in the test suite might still depend on the US English version of the strings, e.g. to grep some error message or other output. -To smoke out issues like these Git can be compiled with gettext poison -support, at the top-level: +To smoke out issues like these, we can use a podebug [1] utility +to generate a pseudotranslation. At top level: - make GETTEXT_POISON=YesPlease + # Assume locale "vi_VN.UTF-8" is supported by system + make pseudo-locale L=vi + make GETTEXT_POISON=vi_VN.UTF-8 test That'll give you a git which emits gibberish on every call to -gettext. It's obviously not meant to be installed, but you should run -the test suite with it: - - cd t && prove -j 9 ./t[0-9]*.sh +gettext. If tests break with it you should inspect them manually and see if what you're translating is sane, i.e. that you're not translating
@@ -290,3 +289,5 @@ test_cmp calls with test_i18ncmp. If that's not enough you can skip the whole test by making it depend on the C_LOCALE_OUTPUT prerequisite. See existing test files with this prerequisite for examples. + +[1] http://translate.sourceforge.net/wiki/toolkit/podebug
t/.gitignore +1 -0
@@ -1,3 +1,4 @@ /trash directory* /test-results /.prove +/test.po*
t/lib-gettext.sh +6 -1
@@ -5,7 +5,12 @@ . ./test-lib.sh -GIT_TEXTDOMAINDIR="$GIT_BUILD_DIR/po/build/locale" +if test -n "$GETTEXT_POISON" +then + GIT_TEXTDOMAINDIR="$GIT_BUILD_DIR/po/build/pseudo-locale" +else + GIT_TEXTDOMAINDIR="$GIT_BUILD_DIR/po/build/locale" +fi GIT_PO_PATH="$GIT_BUILD_DIR/po" export GIT_TEXTDOMAINDIR GIT_PO_PATH
t/t0200-gettext-basic.sh +1 -0
@@ -36,6 +36,7 @@ test_expect_success GETTEXT 'sanity: $TEXTDOMAINDIR exists without NO_GETTEXT=Ye ' test_expect_success GETTEXT 'sanity: Icelandic locale was compiled' ' + test -n "$GETTEXT_POISON" || test -f "$TEXTDOMAINDIR/is/LC_MESSAGES/git.mo" '
t/t0205-gettext-poison.sh deleted +0 -36
@@ -1,36 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2010 Ævar Arnfjörð Bjarmason -# - -test_description='Gettext Shell poison' - -. ./lib-gettext.sh - -test_expect_success GETTEXT_POISON "sanity: \$GIT_INTERNAL_GETTEXT_SH_SCHEME is set (to $GIT_INTERNAL_GETTEXT_SH_SCHEME)" ' - test -n "$GIT_INTERNAL_GETTEXT_SH_SCHEME" -' - -test_expect_success GETTEXT_POISON 'sanity: $GIT_INTERNAL_GETTEXT_SH_SCHEME" is poison' ' - test "$GIT_INTERNAL_GETTEXT_SH_SCHEME" = "poison" -' - -test_expect_success GETTEXT_POISON 'gettext: our gettext() fallback has poison semantics' ' - printf "# GETTEXT POISON #" >expect && - gettext "test" >actual && - test_cmp expect actual && - printf "# GETTEXT POISON #" >expect && - gettext "test more words" >actual && - test_cmp expect actual -' - -test_expect_success GETTEXT_POISON 'eval_gettext: our eval_gettext() fallback has poison semantics' ' - printf "# GETTEXT POISON #" >expect && - eval_gettext "test" >actual && - test_cmp expect actual && - printf "# GETTEXT POISON #" >expect && - eval_gettext "test more words" >actual && - test_cmp expect actual -' - -test_done
t/test-lib.sh +1 -1
@@ -626,7 +626,7 @@ test -z "$NO_GETTEXT" && test_set_prereq GETTEXT # Can we rely on git's output in the C locale? if test -n "$GETTEXT_POISON" then - GIT_GETTEXT_POISON=YesPlease + GIT_GETTEXT_POISON=$GETTEXT_POISON export GIT_GETTEXT_POISON test_set_prereq GETTEXT_POISON else
wrap-for-bin.sh +9 -1
@@ -15,7 +15,15 @@ else export GIT_TEMPLATE_DIR fi GITPERLLIB='@@BUILD_DIR@@/perl/blib/lib' -GIT_TEXTDOMAINDIR='@@BUILD_DIR@@/po/build/locale' +if test -n "$GIT_GETTEXT_POISON" +then + GIT_TEXTDOMAINDIR='@@BUILD_DIR@@/po/build/pseudo-locale' + LANG=$GIT_GETTEXT_POISON + unset LC_ALL + export LANG +else + GIT_TEXTDOMAINDIR='@@BUILD_DIR@@/po/build/locale' +fi PATH='@@BUILD_DIR@@/bin-wrappers:'"$PATH" export GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR
Signature · 1 line
1.7.12.rc2
PATCH 4/6 Initialize gettext for test programs that may use it
In reply to Nguyễn Thái Ngọc DuyGettext poison was a macro and _() always returned "# GETTEXT POISON #". Now that we use real gettext(), it has to be initialized or it won't work.
--- test-date.c | 1 + test-delta.c | 1 + test-dump-cache-tree.c | 5 ++++- test-index-version.c | 1 + test-match-trees.c | 1 + test-mergesort.c | 1 + test-parse-options.c | 1 + test-path-utils.c | 1 + test-revision-walking.c | 1 + test-scrap-cache-tree.c | 4 +++- test-sha1.c | 1 + test-subprocess.c | 1 + 12 files changed, 17 insertions(+), 2 deletions(-)
test-date.c +1 -0
@@ -48,6 +48,7 @@ int main(int argc, char **argv)struct timeval now;const char *x; +git_setup_gettext (); x =getenv ("TEST_DATE_NOW" );if (x) { now.tv_sec =atoi (x);
test-delta.c +1 -0
@@ -22,6 +22,7 @@ int main(int argc, char *argv[])void *from_buf, *data_buf, *out_buf;unsigned long from_size, data_size, out_size; +git_setup_gettext ();if (argc !=5 || (strcmp (argv[1 ],"-d" ) &&strcmp (argv[1 ],"-p" ))) {fprintf (stderr,"Usage: %s\n" , usage_str);return 1 ;
test-dump-cache-tree.c +4 -1
@@ -56,7 +56,10 @@ static int dump_cache_tree(struct cache_tree *it,int main (int ac,char **av) { -struct cache_tree *another =cache_tree (); +struct cache_tree *another; + +git_setup_gettext (); + another =cache_tree ();if (read_cache () <0 )die ("unable to read index file" );cache_tree_update (another, active_cache, active_nr,WRITE_TREE_DRY_RUN );
test-index-version.c +1 -0
@@ -5,6 +5,7 @@ int main(int argc, const char **argv)struct cache_header hdr;int version; +git_setup_gettext ();memset (&hdr,0 ,sizeof (hdr));if (read (0 , &hdr,sizeof (hdr)) !=sizeof (hdr))return 0 ;
test-match-trees.c +1 -0
@@ -6,6 +6,7 @@ int main(int ac, char **av)unsigned char hash1[20 ], hash2[20 ], shifted[20 ];struct tree *one, *two; +git_setup_gettext ();if (get_sha1 (av[1 ], hash1))die ("cannot parse %s as an object name" , av[1 ]);if (get_sha1 (av[2 ], hash2))
test-mergesort.c +1 -0
@@ -27,6 +27,7 @@ int main(int argc, const char **argv)struct line *line, *p =NULL , *lines =NULL ;struct strbuf sb =STRBUF_INIT ; +git_setup_gettext ();for (;;) {if (strbuf_getwholeline (&sb, stdin,'\n' ))break ;
test-parse-options.c +1 -0
@@ -81,6 +81,7 @@ int main(int argc, const char **argv) };int i; +git_setup_gettext (); argc =parse_options (argc, argv, prefix, options, usage,0 );printf ("boolean: %d\n" , boolean);
test-path-utils.c +1 -0
@@ -2,6 +2,7 @@int main (int argc,char **argv) { +git_setup_gettext ();if (argc ==3 && !strcmp (argv[1 ],"normalize_path_copy" )) {char *buf =xmalloc (PATH_MAX +1 );int rv =normalize_path_copy (buf, argv[2 ]);
test-revision-walking.c +1 -0
@@ -47,6 +47,7 @@ static int run_revision_walk(void)int main (int argc,char **argv) { +git_setup_gettext ();if (argc <2 )return 1 ;
test-scrap-cache-tree.c +3 -1
@@ -6,7 +6,9 @@ static struct lock_file index_lock;int main (int ac,char **av) { -int fd =hold_locked_index (&index_lock,1 ); +int fd; +git_setup_gettext (); + fd =hold_locked_index (&index_lock,1 );if (read_cache () <0 )die ("unable to read index file" ); active_cache_tree =NULL ;
test-sha1.c +1 -0
@@ -7,6 +7,7 @@ int main(int ac, char **av)unsigned bufsz =8192 ;char *buffer; +git_setup_gettext ();if (ac ==2 ) bufsz =strtoul (av[1 ],NULL ,10 ) *1024 *1024 ;
test-subprocess.c +1 -0
@@ -6,6 +6,7 @@ int main(int argc, const char **argv)struct child_process cp;int nogit =0 ; +git_setup_gettext ();setup_git_directory_gently (&nogit);if (nogit)die ("No git repo found" );
Signature · 1 line
1.7.12.rc2
PATCH 5/6 Support logging unmarked strings
In reply to Nguyễn Thái Ngọc Duy---
Hard coding path obviously won't fly..
.gitignore | 1 + wrap-for-bin.sh | 6 ++++++ 2 files changed, 7 insertions(+)
.gitignore +1 -0
@@ -195,6 +195,7 @@ /test-sigchain /test-subprocess /test-svn-fe +/untranslated.log /common-cmds.h *.tar.gz *.dsc
wrap-for-bin.sh +6 -0
@@ -17,6 +17,12 @@ fi GITPERLLIB='@@BUILD_DIR@@/perl/blib/lib' if test -n "$GIT_GETTEXT_POISON" then + if test -x /usr/lib/preloadable_libintl.so + then + GETTEXT_LOG_UNTRANSLATED=@@BUILD_DIR@@/untranslated.log + LD_PRELOAD="/usr/lib/preloadable_libintl.so $LD_PRELOAD" + export LD_PRELOAD GETTEXT_LOG_UNTRANSLATED + fi GIT_TEXTDOMAINDIR='@@BUILD_DIR@@/po/build/pseudo-locale' LANG=$GIT_GETTEXT_POISON unset LC_ALL
Signature · 1 line
1.7.12.rc2
PATCH 6/6 test-parse-options: mark parseopt help strings for pseudotranslation
In reply to Nguyễn Thái Ngọc DuyThis reduces the number of false positives in untranslated.log when we check for unmarked strings.
--- test-parse-options.c | 62 ++++++++++++++++++++++++++-------------------------- 1 file changed, 31 insertions(+), 31 deletions(-)
test-parse-options.c +31 -31
@@ -33,50 +33,50 @@ int main(int argc, const char **argv) {const char *prefix ="prefix/" ;const char *usage[] = { -"test-parse-options <options>" , +N_ ("test-parse-options <options>" ),NULL };struct option options[] = { -OPT_BOOL (0 ,"yes" , &boolean,"get a boolean" ), -OPT_BOOL ('D' ,"no-doubt" , &boolean,"begins with 'no-'" ), +OPT_BOOL (0 ,"yes" , &boolean,N_ ("get a boolean" )), +OPT_BOOL ('D' ,"no-doubt" , &boolean,N_ ("begins with 'no-'" )), {OPTION_SET_INT ,'B' ,"no-fear" , &boolean,NULL , -"be brave" ,PARSE_OPT_NOARG |PARSE_OPT_NONEG ,NULL ,1 }, -OPT_COUNTUP ('b' ,"boolean" , &boolean,"increment by one" ), +N_ ("be brave" ),PARSE_OPT_NOARG |PARSE_OPT_NONEG ,NULL ,1 }, +OPT_COUNTUP ('b' ,"boolean" , &boolean,N_ ("increment by one" )),OPT_BIT ('4' ,"or4" , &boolean, -"bitwise-or boolean with ...0100" ,4 ), -OPT_NEGBIT (0 ,"neg-or4" , &boolean,"same as --no-or4" ,4 ), +N_ ("bitwise-or boolean with ...0100" ),4 ), +OPT_NEGBIT (0 ,"neg-or4" , &boolean,N_ ("same as --no-or4" ),4 ),OPT_GROUP ("" ), -OPT_INTEGER ('i' ,"integer" , &integer,"get a integer" ), -OPT_INTEGER ('j' ,NULL , &integer,"get a integer, too" ), -OPT_SET_INT (0 ,"set23" , &integer,"set integer to 23" ,23 ), -OPT_DATE ('t' ,NULL , ×tamp,"get timestamp of <time>" ), -OPT_CALLBACK ('L' ,"length" , &integer,"str" , -"get length of <str>" , length_callback), -OPT_FILENAME ('F' ,"file" , &file,"set file to <file>" ), -OPT_GROUP ("String options" ), -OPT_STRING ('s' ,"string" , &string,"string" ,"get a string" ), -OPT_STRING (0 ,"string2" , &string,"str" ,"get another string" ), -OPT_STRING (0 ,"st" , &string,"st" ,"get another string (pervert ordering)" ), -OPT_STRING ('o' ,NULL , &string,"str" ,"get another string" ), +OPT_INTEGER ('i' ,"integer" , &integer,N_ ("get a integer" )), +OPT_INTEGER ('j' ,NULL , &integer,N_ ("get a integer, too" )), +OPT_SET_INT (0 ,"set23" , &integer,N_ ("set integer to 23" ),23 ), +OPT_DATE ('t' ,NULL , ×tamp,N_ ("get timestamp of <time>" )), +OPT_CALLBACK ('L' ,"length" , &integer,N_ ("str" ), +N_ ("get length of <str>" ), length_callback), +OPT_FILENAME ('F' ,"file" , &file,N_ ("set file to <file>" )), +OPT_GROUP (N_ ("String options" )), +OPT_STRING ('s' ,"string" , &string,N_ ("string" ),N_ ("get a string" )), +OPT_STRING (0 ,"string2" , &string,N_ ("str" ),N_ ("get another string" )), +OPT_STRING (0 ,"st" , &string,N_ ("st" ),N_ ("get another string (pervert ordering)" )), +OPT_STRING ('o' ,NULL , &string,N_ ("str" ),N_ ("get another string" )),OPT_NOOP_NOARG (0 ,"obsolete" ),OPT_SET_PTR (0 ,"default-string" , &string, -"set string to default" , (unsigned long )"default" ), -OPT_STRING_LIST (0 ,"list" , &list,"str" ,"add str to list" ), -OPT_GROUP ("Magic arguments" ), -OPT_ARGUMENT ("quux" ,"means --quux" ), -OPT_NUMBER_CALLBACK (&integer,"set integer to NUM" , +N_ ("set string to default" ), (unsigned long )"default" ), +OPT_STRING_LIST (0 ,"list" , &list,N_ ("str" ),N_ ("add str to list" )), +OPT_GROUP (N_ ("Magic arguments" )), +OPT_ARGUMENT ("quux" ,N_ ("means --quux" )), +OPT_NUMBER_CALLBACK (&integer,N_ ("set integer to NUM" ), number_callback), - {OPTION_COUNTUP ,'+' ,NULL , &boolean,NULL ,"same as -b" , + {OPTION_COUNTUP ,'+' ,NULL , &boolean,NULL ,N_ ("same as -b" ),PARSE_OPT_NOARG |PARSE_OPT_NONEG |PARSE_OPT_NODASH }, {OPTION_COUNTUP ,0 ,"ambiguous" , &ambiguous,NULL , -"positive ambiguity" ,PARSE_OPT_NOARG |PARSE_OPT_NONEG }, +N_ ("positive ambiguity" ),PARSE_OPT_NOARG |PARSE_OPT_NONEG }, {OPTION_COUNTUP ,0 ,"no-ambiguous" , &ambiguous,NULL , -"negative ambiguity" ,PARSE_OPT_NOARG |PARSE_OPT_NONEG }, -OPT_GROUP ("Standard options" ), +N_ ("negative ambiguity" ),PARSE_OPT_NOARG |PARSE_OPT_NONEG }, +OPT_GROUP (N_ ("Standard options" )),OPT__ABBREV (&abbrev), -OPT__VERBOSE (&verbose,"be verbose" ), -OPT__DRY_RUN (&dry_run,"dry run" ), -OPT__QUIET (&quiet,"be quiet" ), +OPT__VERBOSE (&verbose,N_ ("be verbose" )), +OPT__DRY_RUN (&dry_run,N_ ("dry run" )), +OPT__QUIET (&quiet,N_ ("be quiet" )),OPT_END (), };int i;
Signature · 1 line
1.7.12.rc2
Quoted 3 lines · Nguyễn Thái Ngọc Duy
Still WIP but I'm getting closer. I dropped test-poisongen and started to use podebug [2] instead. Less code in git. podebug does not preserve shell variables yet. I'll follow that up at upstream [1].
Thanks; this looks promising.
Quoted 10 lines · Nguyễn Thái Ngọc Duy
Still WIP but I'm getting closer. I dropped test-poisongen and started to use podebug [2] instead. Less code in git. podebug does not preserve shell variables yet. I'll follow that up at upstream [1].
With this series, if you have translation toolkit installed, you could do
make pseudo-locale L=<your language code>
make GETTEXT_POISON=$LANG test
Quoted 8 lines
podebug supports a few way of rewriting translations. Currently "unicode" is used but you can change it via
PODEBUG_OPTSt9001 is not happy with $LANG != C though. May need to add some prereq there.
[1] http://bugs.locamotion.org/show_bug.cgi?id=2450
[2] http://translate.sourceforge.net/wiki/toolkit/podebug
The reason I didn't do something like this to begin with is that gettext/glibc doesn't have support for fake locales, so you'd have to appropriate a real one for tests. It's good to see you poking the gettext mailing list about adding support far thot.
But something like podebug gets around that quite nicely, so we can still have the testing the poison stuff was intended for, without the complexity of supporting it throughout all our i18n code.
Quoted 7 lines · Ævar Arnfjörð Bjarmason
Quoted 2 lines
[1] http://bugs.locamotion.org/show_bug.cgi?id=2450
[2] http://translate.sourceforge.net/wiki/toolkit/podebugThe reason I didn't do something like this to begin with is that gettext/glibc doesn't have support for fake locales, so you'd have to appropriate a real one for tests. It's good to see you poking the gettext mailing list about adding support far thot.
I don't see glibc getting fake locale support any time soon even if it's more open than before. I can try to make gettext support pseudo translations, though not sure if I can make it.
Quoted 3 lines
But something like podebug gets around that quite nicely, so we can still have the testing the poison stuff was intended for, without the complexity of supporting it throughout all our i18n code.
But yes, even if gettext does not have native support, relying on podebug should be ok. Whatever changes we need, other projects might too. It's better to do it outside of git.
Signature · 1 line
Duy1