git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v4 00/38] i18n and test updates

From
Vasco Almeida <vascomalmeida@sapo.pt>
Date
Jun 7, 2016, 11:51 UTC
Message-ID
<1465300357-7557-1-git-send-email-vascomalmeida@sapo.pt>

Marks several messages for translation and updates tests to pass under GETTEXT_POISON. Some tests were updated to fit previous i18n marks, others were updated to fit marks made by these patches. Patches that only touch test file refer to marks done in commits previous to these ones.

Depends on commit fe17fc0 ("t2300: run git-sh-setup in an environment that better mimics the real life", 2016-06-01) in 'next' branch to pass that test.

Drop "[PATCH v3 24/39] i18n: bisect: enable l10n of bisect terms in" from previous re-roll.

Previous discussion: http://thread.gmane.org/gmane.comp.version-control.git/296106

Interdiff v3 v4 included bellow.
Vasco Almeida (38):
  i18n: builtin/remote.c: fix mark for translation
  i18n: advice: mark string about detached head for translation
  i18n: advice: internationalize message for conflicts
  i18n: transport: mark strings for translation
  i18n: sequencer: mark entire sentences for translation
  i18n: sequencer: mark string for translation
  i18n: merge-octopus: mark messages for translation
  merge-octupus: use die shell function from git-sh-setup.sh
  i18n: rebase: fix marked string to use eval_gettext variant
  i18n: rebase: mark placeholder for translation
  i18n: bisect: simplify error message for i18n
  t6030: update to use test_i18ncmp
  i18n: git-sh-setup.sh: mark strings for translation
  i18n: rebase-interactive: mark strings for translation
  i18n: rebase-interactive: mark here-doc strings for translation
  i18n: rebase-interactive: mark comments of squash for translation
  i18n: setup: mark strings for translation
  tests: use test_i18n* functions to suppress false positives
  tests: unpack-trees: update to use test_i18n* functions
  t9003: become resilient to GETTEXT_POISON
  t4153: fix negated test_i18ngrep call
  t5523: use test_i18ngrep for negation
  i18n: bisect: mark strings for translation
  i18n: transport-helper.c: change N_() call to _()
  i18n: notes: mark strings for translation
  i18n: notes: mark options for translation
  i18n: config: unfold error messages marked for translation
  i18n: merge: mark messages for translation
  i18n: merge: change command option help to lowercase
  i18n: sequencer: add period to error message
  i18n: standardise messages
  i18n: remote: mark URL fallback text for translation
  i18n: remote: allow translations to reorder message
  i18n: init-db: join message pieces
  i18n: submodule: join strings marked for translation
  i18n: submodule: escape shell variables inside eval_gettext
  i18n: unmark die messages for translation
  i18n: branch: mark comment when editing branch description for
    translation
 Makefile                              |   5 +-
 advice.c                              |  23 ++-
 bisect.c                              |  56 ++++---
 builtin/apply.c                       |   6 +-
 builtin/branch.c                      |   6 +-
 builtin/checkout.c                    |   6 +-
 builtin/init-db.c                     |  17 +-
 builtin/merge.c                       |  12 +-
 builtin/notes.c                       |  24 +--
 builtin/pull.c                        |   2 +-
 builtin/remote.c                      |  19 ++-
 builtin/repack.c                      |   2 +-
 cache.h                               |   9 +-
 config.c                              | 101 ++++++++++--
 git-bisect.sh                         |   8 +-
 git-merge-octopus.sh                  |  23 ++-
 git-rebase--interactive.sh            | 290 ++++++++++++++++++++--------------
 git-rebase.sh                         |   5 +-
 git-sh-i18n.sh                        |  18 +++
 git-sh-setup.sh                       |  63 ++++++--
 git-stash.sh                          |   1 -
 git-submodule.sh                      |  23 +--
 sequencer.c                           |  15 +-
 setup.c                               |  16 +-
 submodule-config.c                    |   2 +-
 t/lib-rebase.sh                       |   1 +
 t/t0008-ignores.sh                    |   4 +-
 t/t1011-read-tree-sparse-checkout.sh  |   2 +-
 t/t1300-repo-config.sh                |   8 +-
 t/t1307-config-blob.sh                |   5 +-
 t/t1308-config-set.sh                 |   4 +-
 t/t1400-update-ref.sh                 |   2 +-
 t/t1506-rev-parse-diagnosis.sh        |   2 +-
 t/t2010-checkout-ambiguous.sh         |   2 +-
 t/t2018-checkout-branch.sh            |   2 +-
 t/t3200-branch.sh                     |   6 +-
 t/t3201-branch-contains.sh            |   2 +-
 t/t3310-notes-merge-manual-resolve.sh |   8 +-
 t/t3320-notes-merge-worktrees.sh      |   4 +-
 t/t3400-rebase.sh                     |   4 +-
 t/t3404-rebase-interactive.sh         |  18 +--
 t/t4153-am-resume-override-opts.sh    |   2 +-
 t/t4208-log-magic-pathspec.sh         |   4 +-
 t/t5505-remote.sh                     |   2 +-
 t/t5510-fetch.sh                      |   2 +-
 t/t5520-pull.sh                       |   2 +-
 t/t5523-push-upstream.sh              |  12 +-
 t/t5536-fetch-conflicts.sh            |   4 +-
 t/t6030-bisect-porcelain.sh           |  26 +--
 t/t6301-for-each-ref-errors.sh        |  10 +-
 t/t7063-status-untracked-cache.sh     |   2 +-
 t/t7102-reset.sh                      |   4 +-
 t/t7201-co.sh                         |   2 +-
 t/t7400-submodule-basic.sh            |   2 +-
 t/t7403-submodule-sync.sh             |   4 +-
 t/t7406-submodule-update.sh           |  10 +-
 t/t7508-status.sh                     |   4 +-
 t/t7607-merge-overwrite.sh            |   2 +-
 t/t9003-help-autocorrect.sh           |   4 +-
 transport-helper.c                    |   2 +-
 transport.c                           |  20 +--
 wt-status.c                           |   4 +-
 62 files changed, 576 insertions(+), 374 deletions(-)
---- >8 ----
diff --git a/bisect.c b/bisect.c
index 293d7ec..a8713a8 100644
--- a/bisect.c
+++ b/bisect.c
@@ -23,15 +23,6 @@ static const char *argv_show_branch[] = {"show-branch", NULL, NULL};
 static const char *term_bad;
 static const char *term_good;
 
-enum term { BAD, GOOD, OLD, NEW };
-static const char *term_names[] = {
-/* TRANSLATORS: in bisect.c source code file, the following terms are
-   used to describe a "bad commit", "good commit", "new revision", etc.
-   Please, if you can, check the source when you are not sure if a %s
-   would be replaced by one of the following terms. */
-	N_("bad"), N_("good"), N_("old"), N_("new"),  NULL
-};
-
 /* Remember to update object flag allocation in object.h */
 #define COUNTED		(1u<<16)
 
@@ -734,12 +725,12 @@ static void handle_bad_merge_base(void)
 	if (is_expected_rev(current_bad_oid)) {
 		char *bad_hex = oid_to_hex(current_bad_oid);
 		char *good_hex = join_sha1_array_hex(&good_revs, ' ');
-		if (!strcmp(term_bad, term_names[BAD]) && !strcmp(term_good, term_names[GOOD])) {
+		if (!strcmp(term_bad, "bad") && !strcmp(term_good, "good")) {
 			fprintf(stderr, _("The merge base %s is bad.\n"
 				"This means the bug has been fixed "
 				"between %s and [%s].\n"),
 				bad_hex, bad_hex, good_hex);
-		} else if (!strcmp(term_bad, term_names[NEW]) && !strcmp(term_good, term_names[OLD])) {
+		} else if (!strcmp(term_bad, "new") && !strcmp(term_good, "old")) {
 			fprintf(stderr, _("The merge base %s is new.\n"
 				"The property has changed "
 				"between %s and [%s].\n"),
@@ -748,7 +739,7 @@ static void handle_bad_merge_base(void)
 			fprintf(stderr, _("The merge base %s is %s.\n"
 				"This means the first '%s' commit is "
 				"between %s and [%s].\n"),
-				bad_hex, _(term_bad), _(term_good), bad_hex, good_hex);
+				bad_hex, term_bad, term_good, bad_hex, good_hex);
 		}
 		exit(3);
 	}
@@ -756,7 +747,7 @@ static void handle_bad_merge_base(void)
 	fprintf(stderr, _("Some %s revs are not ancestor of the %s rev.\n"
 		"git bisect cannot work properly in this case.\n"
 		"Maybe you mistook %s and %s revs?\n"),
-		_(term_good), _(term_bad), _(term_good), _(term_bad));
+		term_good, term_bad, term_good, term_bad);
 	exit(1);
 }
 
@@ -771,7 +762,7 @@ static void handle_skipped_merge_base(const unsigned char *mb)
 		"So we cannot be sure the first %s commit is "
 		"between %s and %s.\n"
 		"We continue anyway."),
-		bad_hex, good_hex, _(term_bad), mb_hex, bad_hex);
+		bad_hex, good_hex, term_bad, mb_hex, bad_hex);
 	free(good_hex);
 }
 
@@ -852,7 +843,7 @@ static void check_good_are_ancestors_of_bad(const char *prefix, int no_checkout)
 	int fd;
 
 	if (!current_bad_oid)
-		die(_("a %s revision is needed"), _(term_bad));
+		die(_("a %s revision is needed"), term_bad);
 
 	/* Check if file BISECT_ANCESTORS_OK exists. */
 	if (!stat(filename, &st) && S_ISREG(st.st_mode))
@@ -915,8 +906,8 @@ void read_bisect_terms(const char **read_bad, const char **read_good)
 
 	if (!fp) {
 		if (errno == ENOENT) {
-			*read_bad = term_names[BAD];
-			*read_good = term_names[GOOD];
+			*read_bad = "bad";
+			*read_good = "good";
 			return;
 		} else {
 			die_errno(_("could not read file '%s'"), filename);
@@ -971,8 +962,8 @@ int bisect_next_all(const char *prefix, int no_checkout)
 
 		printf(_("%s was both %s and %s\n"),
 		       oid_to_hex(current_bad_oid),
-		       _(term_good),
-		       _(term_bad));
+		       term_good,
+		       term_bad);
 		exit(1);
 	}
 
diff --git a/config.c b/config.c
index b08a418..e86f0aa 100644
--- a/config.c
+++ b/config.c
@@ -417,7 +417,8 @@ static int git_parse_source(config_fn_t fn, void *data)
 	int comment = 0;
 	int baselen = 0;
 	struct strbuf *var = &cf->var;
-	char error_msg[128];
+	int error_return = 0;
+	char *error_msg = NULL;
 
 	/* U+FEFF Byte Order Mark in UTF8 */
 	const char *bomptr = utf8_bom;
@@ -475,35 +476,33 @@ static int git_parse_source(config_fn_t fn, void *data)
 
 	switch (cf->origin_type) {
 	case CFG_BLOB:
-		xsnprintf(error_msg, sizeof(error_msg),
-			  _("bad config line %d in blob %s"),
-			  cf->linenr, cf->name);
+		error_msg = xstrfmt(_("bad config line %d in blob %s"),
+				      cf->linenr, cf->name);
 		break;
 	case CFG_FILE:
-		xsnprintf(error_msg, sizeof(error_msg),
-			  _("bad config line %d in file %s"),
-			  cf->linenr, cf->name);
+		error_msg = xstrfmt(_("bad config line %d in file %s"),
+				      cf->linenr, cf->name);
 		break;
 	case CFG_STDIN:
-		xsnprintf(error_msg, sizeof(error_msg),
-			  _("bad config line %d in standard input"),
-			  cf->linenr);
+		error_msg = xstrfmt(_("bad config line %d in standard input"),
+				      cf->linenr);
 		break;
 	case CFG_SUBMODULE_BLOB:
-		xsnprintf(error_msg, sizeof(error_msg),
-			  _("bad config line %d in submodule-blob %s"),
-			  cf->linenr, cf->name);
+		error_msg = xstrfmt(_("bad config line %d in submodule-blob %s"),
+				       cf->linenr, cf->name);
 		break;
 	default:
-		xsnprintf(error_msg, sizeof(error_msg),
-			  _("bad config line %d in %s"),
-			  cf->linenr, cf->name);
+		error_msg = xstrfmt(_("bad config line %d in %s"),
+				      cf->linenr, cf->name);
 	}
 
 	if (cf->die_on_error)
 		die(error_msg);
 	else
-		return error(error_msg);
+		error_return =  error(error_msg);
+
+	free(error_msg);
+	return error_return;
 }
 
 static int parse_unit_factor(const char *end, uintmax_t *val)
diff --git a/git-bisect.sh b/git-bisect.sh
index c9acab6..ae3cb01 100755
--- a/git-bisect.sh
+++ b/git-bisect.sh
@@ -33,7 +33,6 @@ Please use "git help bisect" to get the full man page.'
 
 OPTIONS_SPEC=
 . git-sh-setup
-. git-sh-i18n
 
 _x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
 _x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
diff --git a/git-merge-octopus.sh b/git-merge-octopus.sh
index d79fc84..308eafd 100755
--- a/git-merge-octopus.sh
+++ b/git-merge-octopus.sh
@@ -6,7 +6,6 @@
 #
 
 . git-sh-setup
-. git-sh-i18n
 
 LF='
 '
diff --git a/git-rebase.sh b/git-rebase.sh
index 9ba21ab..04f6e44 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -45,7 +45,6 @@ skip!              skip current patch and continue
 edit-todo!         edit the todo list during an interactive rebase
 "
 . git-sh-setup
-. git-sh-i18n
 set_reflog_action rebase
 require_work_tree_exists
 cd_to_toplevel
diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index 61a3d95..2eda134 100644
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -2,9 +2,8 @@
 # to set up some variables pointing at the normal git directories and
 # a few helper shell functions.
 
-# Some shell scripts source git-sh-setup (i.e. this scriplet) but
-# don't source git-sh-i18n which is needed here for gettext support.
-. "$(git --exec-path)"/git-sh-i18n
+# Source git-sh-i18n for gettext support.
+. git-sh-i18n
 
 # Having this variable in your environment would break scripts because
 # you would cause "cd" to be taken to unexpected places.  If you
@@ -87,16 +86,16 @@ if test -n "$OPTIONS_SPEC"; then
 else
 	dashless=$(basename -- "$0" | sed -e 's/-/ /')
 	usage() {
-		die "$(gettext usage:) $dashless $USAGE"
+		die "$(eval_gettext "usage: \$dashless \$USAGE")"
 	}
 
 	if [ -z "$LONG_USAGE" ]
 	then
-		LONG_USAGE="$(gettext usage:) $dashless $USAGE"
+		LONG_USAGE="$(eval_gettext "usage: \$dashless \$USAGE")"
 	else
-		LONG_USAGE="$(gettext usage:) $dashless $USAGE
+		LONG_USAGE="$(eval_gettext "usage: \$dashless \$USAGE
 
-$LONG_USAGE"
+$LONG_USAGE")"
 	fi
 
 	case "$1" in
diff --git a/git-stash.sh b/git-stash.sh
index c7509e8..22fb8bc 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -15,7 +15,6 @@ SUBDIRECTORY_OK=Yes
 OPTIONS_SPEC=
 START_DIR=$(pwd)
 . git-sh-setup
-. git-sh-i18n
 require_work_tree
 cd_to_toplevel
 
diff --git a/git-submodule.sh b/git-submodule.sh
index f6e0c28..1ff2f3a 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -16,7 +16,6 @@ USAGE="[--quiet] add [-b <branch>] [-f|--force] [--name <name>] [--reference <re
 OPTIONS_SPEC=
 SUBDIRECTORY_OK=Yes
 . git-sh-setup
-. git-sh-i18n
 . git-parse-remote
 require_work_tree
 wt_prefix=$(git rev-parse --show-prefix)
---- >8 ----
-- 
2.7.3
Next: Vasco Almeida
Message 1 of 43 in “i18n and test updates”
  1. 00/38 i18n and test updatesVasco Almeida, Jun 7, 2016
  2. 01/38 i18n: builtin/remote.c: fix mark for translationVasco Almeida, Jun 7, 2016
  3. 02/38 i18n: advice: mark string about detached head for translationVasco Almeida, Jun 7, 2016
  4. 03/38 i18n: advice: internationalize message for conflictsVasco Almeida, Jun 7, 2016
  5. 04/38 i18n: transport: mark strings for translationVasco Almeida, Jun 7, 2016
  6. 05/38 i18n: sequencer: mark entire sentences for translationVasco Almeida, Jun 7, 2016
  7. 06/38 i18n: sequencer: mark string for translationVasco Almeida, Jun 7, 2016
  8. 07/38 i18n: merge-octopus: mark messages for translationVasco Almeida, Jun 7, 2016
  9. 08/38 merge-octupus: use die shell function from git-sh-setup.shVasco Almeida, Jun 7, 2016
  10. 09/38 i18n: rebase: fix marked string to use eval_gettext variantVasco Almeida, Jun 7, 2016
  11. 10/38 i18n: rebase: mark placeholder for translationVasco Almeida, Jun 7, 2016
  12. 11/38 i18n: bisect: simplify error message for i18nVasco Almeida, Jun 7, 2016
  13. 12/38 t6030: update to use test_i18ncmpVasco Almeida, Jun 7, 2016
  14. 13/38 i18n: git-sh-setup.sh: mark strings for translationVasco Almeida, Jun 7, 2016
  15. 14/38 i18n: rebase-interactive: mark strings for translationVasco Almeida, Jun 7, 2016
  16. 15/38 i18n: rebase-interactive: mark here-doc strings for translationVasco Almeida, Jun 7, 2016
  17. 16/38 i18n: rebase-interactive: mark comments of squash for translationVasco Almeida, Jun 7, 2016
  18. 17/38 i18n: setup: mark strings for translationVasco Almeida, Jun 7, 2016
  19. 18/38 tests: use test_i18n* functions to suppress false positivesVasco Almeida, Jun 7, 2016
  20. 19/38 tests: unpack-trees: update to use test_i18n* functionsVasco Almeida, Jun 7, 2016
  21. 20/38 t9003: become resilient to GETTEXT_POISONVasco Almeida, Jun 7, 2016
  22. 21/38 t4153: fix negated test_i18ngrep callVasco Almeida, Jun 7, 2016
  23. 22/38 t5523: use test_i18ngrep for negationVasco Almeida, Jun 7, 2016
  24. 23/38 i18n: bisect: mark strings for translationVasco Almeida, Jun 7, 2016
  25. 24/38 i18n: transport-helper.c: change N_() call to _()Vasco Almeida, Jun 7, 2016
  26. 25/38 i18n: notes: mark strings for translationVasco Almeida, Jun 7, 2016
  27. 26/38 i18n: notes: mark options for translationVasco Almeida, Jun 7, 2016
  28. 27/38 i18n: config: unfold error messages marked for translationVasco Almeida, Jun 7, 2016
  29. Junio C HamanoJun 7, 2016
  30. 28/38 i18n: merge: mark messages for translationVasco Almeida, Jun 7, 2016
  31. 29/38 i18n: merge: change command option help to lowercaseVasco Almeida, Jun 7, 2016
  32. 30/38 i18n: sequencer: add period to error messageVasco Almeida, Jun 7, 2016
  33. 31/38 i18n: standardise messagesVasco Almeida, Jun 7, 2016
  34. 32/38 i18n: remote: mark URL fallback text for translationVasco Almeida, Jun 7, 2016
  35. 33/38 i18n: remote: allow translations to reorder messageVasco Almeida, Jun 7, 2016
  36. 34/38 i18n: init-db: join message piecesVasco Almeida, Jun 7, 2016
  37. Vasco AlmeidaJun 17, 2016
  38. 35/38 i18n: submodule: join strings marked for translationVasco Almeida, Jun 7, 2016
  39. 36/38 i18n: submodule: escape shell variables inside eval_gettextVasco Almeida, Jun 7, 2016
  40. 37/38 i18n: unmark die messages for translationVasco Almeida, Jun 7, 2016
  41. Junio C HamanoJun 7, 2016
  42. Pranit BauvaJun 8, 2016
  43. 38/38 i18n: branch: mark comment when editing branch description for translationVasco Almeida, Jun 7, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.