{"thread":{"id":"42506","subject":"[PATCH v3 04/39] i18n: transport: mark strings for translation","startedAt":"2016-06-01T16:40:50Z","lastAt":"2016-06-03T12:32:20Z","messageCount":50,"participants":["Vasco Almeida","Junio C Hamano"],"isPatch":true,"patchVersion":3,"patchTotal":39},"messages":[{"id":"288027","messageId":"1464799289-7639-1-git-send-email-vascomalmeida@sapo.pt","threadId":"42506","inReplyTo":null,"subject":"[PATCH v3 00/39] i18n and test updates","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-06-01T16:40:50Z","receivedAt":"2016-06-01T16:40:50Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Marks several messages for translation and updates tests to pass under\nGETTEXT_POISON. Some tests were updated to fit previous i18n marks, others\nwere updated to fit marks made by these patches. Patches that only touch\ntest file refer to marks done in commits previous to these ones.\n\nThis re-roll fixes issues comment on the previous discussion and adds\npatches to mark more strings for translation.\n\nPrevious discussion:\nhttp://thread.gmane.org/gmane.comp.version-control.git/295354\n\nInterdiff v2 v3 included bellow.\n\n\nVasco Almeida (39):\n  i18n: builtin/remote.c: fix mark for translation\n  i18n: advice: mark string about detached head for translation\n  i18n: advice: internationalize message for conflicts\n  i18n: transport: mark strings for translation\n  i18n: sequencer: mark entire sentences for translation\n  i18n: sequencer: mark string for translation\n  i18n: merge-octopus: mark messages for translation\n  merge-octupus: use die shell function from git-sh-setup.sh\n  i18n: rebase: fix marked string to use eval_gettext variant\n  i18n: rebase: mark placeholder for translation\n  i18n: bisect: simplify error message for i18n\n  t6030: update to use test_i18ncmp\n  i18n: git-sh-setup.sh: mark strings for translation\n  i18n: rebase-interactive: mark strings for translation\n  i18n: rebase-interactive: mark here-doc strings for translation\n  i18n: rebase-interactive: mark comments of squash for translation\n  i18n: setup: mark strings for translation\n  tests: use test_i18n* functions to suppress false positives\n  tests: unpack-trees: update to use test_i18n* functions\n  t9003: become resilient to GETTEXT_POISON\n  t4153: fix negated test_i18ngrep call\n  t5523: use test_i18ngrep for negation\n  i18n: bisect: mark strings for translation\n  i18n: bisect: enable l10n of bisect terms in messages\n  i18n: transport-helper.c: change N_() call to _()\n  i18n: notes: mark strings for translation\n  i18n: notes: mark options for translation\n  i18n: config: unfold error messages marked for translation\n  i18n: merge: mark messages for translation\n  i18n: merge: change command option help to lowercase\n  i18n: sequencer: add period to error message\n  i18n: standardise messages\n  i18n: remote: mark URL fallback text for translation\n  i18n: remote: allow translations to reorder message\n  i18n: init-db: join message pieces\n  i18n: submodule: join strings marked for translation\n  i18n: submodule: escape shell variables inside eval_gettext\n  i18n: unmark die messages for translation\n  i18n: branch: mark comment when editing branch description for\n    translation\n\n Makefile                              |   5 +-\n advice.c                              |  23 ++-\n bisect.c                              |  83 ++++++----\n builtin/apply.c                       |   6 +-\n builtin/branch.c                      |   6 +-\n builtin/checkout.c                    |   6 +-\n builtin/init-db.c                     |  17 +-\n builtin/merge.c                       |  12 +-\n builtin/notes.c                       |  24 +--\n builtin/pull.c                        |   2 +-\n builtin/remote.c                      |  19 ++-\n builtin/repack.c                      |   2 +-\n cache.h                               |   9 +-\n config.c                              | 102 ++++++++++--\n git-bisect.sh                         |   7 +-\n git-merge-octopus.sh                  |  24 ++-\n git-rebase--interactive.sh            | 290 ++++++++++++++++++++--------------\n git-rebase.sh                         |   4 +-\n git-sh-i18n.sh                        |  18 +++\n git-sh-setup.sh                       |  62 ++++++--\n git-submodule.sh                      |  22 +--\n sequencer.c                           |  15 +-\n setup.c                               |  16 +-\n submodule-config.c                    |   2 +-\n t/lib-rebase.sh                       |   1 +\n t/t0008-ignores.sh                    |   4 +-\n t/t1011-read-tree-sparse-checkout.sh  |   2 +-\n t/t1300-repo-config.sh                |   8 +-\n t/t1307-config-blob.sh                |   5 +-\n t/t1308-config-set.sh                 |   4 +-\n t/t1400-update-ref.sh                 |   2 +-\n t/t1506-rev-parse-diagnosis.sh        |   2 +-\n t/t2010-checkout-ambiguous.sh         |   2 +-\n t/t2018-checkout-branch.sh            |   2 +-\n t/t3200-branch.sh                     |   6 +-\n t/t3201-branch-contains.sh            |   2 +-\n t/t3310-notes-merge-manual-resolve.sh |   8 +-\n t/t3320-notes-merge-worktrees.sh      |   4 +-\n t/t3400-rebase.sh                     |   4 +-\n t/t3404-rebase-interactive.sh         |  18 +--\n t/t4153-am-resume-override-opts.sh    |   2 +-\n t/t4208-log-magic-pathspec.sh         |   4 +-\n t/t5505-remote.sh                     |   2 +-\n t/t5510-fetch.sh                      |   2 +-\n t/t5520-pull.sh                       |   2 +-\n t/t5523-push-upstream.sh              |  12 +-\n t/t5536-fetch-conflicts.sh            |   4 +-\n t/t6030-bisect-porcelain.sh           |  26 +--\n t/t6301-for-each-ref-errors.sh        |  10 +-\n t/t7063-status-untracked-cache.sh     |   2 +-\n t/t7102-reset.sh                      |   4 +-\n t/t7201-co.sh                         |   2 +-\n t/t7400-submodule-basic.sh            |   2 +-\n t/t7403-submodule-sync.sh             |   4 +-\n t/t7406-submodule-update.sh           |  10 +-\n t/t7508-status.sh                     |   4 +-\n t/t7607-merge-overwrite.sh            |   2 +-\n t/t9003-help-autocorrect.sh           |   4 +-\n transport-helper.c                    |   2 +-\n transport.c                           |  20 +--\n wt-status.c                           |   4 +-\n 61 files changed, 596 insertions(+), 378 deletions(-)\n\n---- 8< ----\ndiff --git a/advice.c b/advice.c\nindex 4612165..b84ae49 100644\n--- a/advice.c\n+++ b/advice.c\n@@ -119,8 +119,8 @@ void NORETURN die_conclude_merge(void)\n \n void detach_advice(const char *new_name)\n {\n-\tconst char fmt[] =\n-\tN_(\"Note: checking out '%s'.\\n\\n\"\n+\tconst char *fmt =\n+\t_(\"Note: checking out '%s'.\\n\\n\"\n \t\"You are in 'detached HEAD' state. You can look around, make experimental\\n\"\n \t\"changes and commit them, and you can discard any commits you make in this\\n\"\n \t\"state without impacting any branches by performing another checkout.\\n\\n\"\ndiff --git a/bisect.c b/bisect.c\nindex 6d93edb..293d7ec 100644\n--- a/bisect.c\n+++ b/bisect.c\n@@ -23,6 +23,15 @@ static const char *argv_show_branch[] = {\"show-branch\", NULL, NULL};\n static const char *term_bad;\n static const char *term_good;\n \n+enum term { BAD, GOOD, OLD, NEW };\n+static const char *term_names[] = {\n+/* TRANSLATORS: in bisect.c source code file, the following terms are\n+   used to describe a \"bad commit\", \"good commit\", \"new revision\", etc.\n+   Please, if you can, check the source when you are not sure if a %s\n+   would be replaced by one of the following terms. */\n+\tN_(\"bad\"), N_(\"good\"), N_(\"old\"), N_(\"new\"),  NULL\n+};\n+\n /* Remember to update object flag allocation in object.h */\n #define COUNTED\t\t(1u<<16)\n \n@@ -438,12 +447,12 @@ static void read_bisect_paths(struct argv_array *array)\n \tFILE *fp = fopen(filename, \"r\");\n \n \tif (!fp)\n-\t\tdie_errno(\"Could not open file '%s'\", filename);\n+\t\tdie_errno(_(\"Could not open file '%s'\"), filename);\n \n \twhile (strbuf_getline_lf(&str, fp) != EOF) {\n \t\tstrbuf_trim(&str);\n \t\tif (sq_dequote_to_argv_array(str.buf, array))\n-\t\t\tdie(\"Badly quoted content in file '%s': %s\",\n+\t\t\tdie(_(\"Badly quoted content in file '%s': %s\"),\n \t\t\t    filename, str.buf);\n \t}\n \n@@ -649,7 +658,7 @@ static void exit_if_skipped_commits(struct commit_list *tried,\n \tprint_commit_list(tried, \"%s\\n\", \"%s\\n\");\n \tif (bad)\n \t\tprintf(\"%s\\n\", oid_to_hex(bad));\n-\tprintf(\"We cannot bisect more!\\n\");\n+\tprintf(_(\"We cannot bisect more!\\n\"));\n \texit(2);\n }\n \n@@ -702,7 +711,7 @@ static struct commit *get_commit_reference(const unsigned char *sha1)\n {\n \tstruct commit *r = lookup_commit_reference(sha1);\n \tif (!r)\n-\t\tdie(\"Not a valid commit name %s\", sha1_to_hex(sha1));\n+\t\tdie(_(\"Not a valid commit name %s\"), sha1_to_hex(sha1));\n \treturn r;\n }\n \n@@ -725,29 +734,29 @@ static void handle_bad_merge_base(void)\n \tif (is_expected_rev(current_bad_oid)) {\n \t\tchar *bad_hex = oid_to_hex(current_bad_oid);\n \t\tchar *good_hex = join_sha1_array_hex(&good_revs, ' ');\n-\t\tif (!strcmp(term_bad, \"bad\") && !strcmp(term_good, \"good\")) {\n-\t\t\tfprintf(stderr, \"The merge base %s is bad.\\n\"\n+\t\tif (!strcmp(term_bad, term_names[BAD]) && !strcmp(term_good, term_names[GOOD])) {\n+\t\t\tfprintf(stderr, _(\"The merge base %s is bad.\\n\"\n \t\t\t\t\"This means the bug has been fixed \"\n-\t\t\t\t\"between %s and [%s].\\n\",\n+\t\t\t\t\"between %s and [%s].\\n\"),\n \t\t\t\tbad_hex, bad_hex, good_hex);\n-\t\t} else if (!strcmp(term_bad, \"new\") && !strcmp(term_good, \"old\")) {\n-\t\t\tfprintf(stderr, \"The merge base %s is new.\\n\"\n+\t\t} else if (!strcmp(term_bad, term_names[NEW]) && !strcmp(term_good, term_names[OLD])) {\n+\t\t\tfprintf(stderr, _(\"The merge base %s is new.\\n\"\n \t\t\t\t\"The property has changed \"\n-\t\t\t\t\"between %s and [%s].\\n\",\n+\t\t\t\t\"between %s and [%s].\\n\"),\n \t\t\t\tbad_hex, bad_hex, good_hex);\n \t\t} else {\n-\t\t\tfprintf(stderr, \"The merge base %s is %s.\\n\"\n+\t\t\tfprintf(stderr, _(\"The merge base %s is %s.\\n\"\n \t\t\t\t\"This means the first '%s' commit is \"\n-\t\t\t\t\"between %s and [%s].\\n\",\n-\t\t\t\tbad_hex, term_bad, term_good, bad_hex, good_hex);\n+\t\t\t\t\"between %s and [%s].\\n\"),\n+\t\t\t\tbad_hex, _(term_bad), _(term_good), bad_hex, good_hex);\n \t\t}\n \t\texit(3);\n \t}\n \n-\tfprintf(stderr, \"Some %s revs are not ancestor of the %s rev.\\n\"\n+\tfprintf(stderr, _(\"Some %s revs are not ancestor of the %s rev.\\n\"\n \t\t\"git bisect cannot work properly in this case.\\n\"\n-\t\t\"Maybe you mistook %s and %s revs?\\n\",\n-\t\tterm_good, term_bad, term_good, term_bad);\n+\t\t\"Maybe you mistook %s and %s revs?\\n\"),\n+\t\t_(term_good), _(term_bad), _(term_good), _(term_bad));\n \texit(1);\n }\n \n@@ -757,12 +766,12 @@ static void handle_skipped_merge_base(const unsigned char *mb)\n \tchar *bad_hex = sha1_to_hex(current_bad_oid->hash);\n \tchar *good_hex = join_sha1_array_hex(&good_revs, ' ');\n \n-\twarning(\"the merge base between %s and [%s] \"\n+\twarning(_(\"the merge base between %s and [%s] \"\n \t\t\"must be skipped.\\n\"\n \t\t\"So we cannot be sure the first %s commit is \"\n \t\t\"between %s and %s.\\n\"\n-\t\t\"We continue anyway.\",\n-\t\tbad_hex, good_hex, term_bad, mb_hex, bad_hex);\n+\t\t\"We continue anyway.\"),\n+\t\tbad_hex, good_hex, _(term_bad), mb_hex, bad_hex);\n \tfree(good_hex);\n }\n \n@@ -792,7 +801,7 @@ static void check_merge_bases(int no_checkout)\n \t\t} else if (0 <= sha1_array_lookup(&skipped_revs, mb)) {\n \t\t\thandle_skipped_merge_base(mb);\n \t\t} else {\n-\t\t\tprintf(\"Bisecting: a merge base must be tested\\n\");\n+\t\t\tprintf(_(\"Bisecting: a merge base must be tested\\n\"));\n \t\t\texit(bisect_checkout(mb, no_checkout));\n \t\t}\n \t}\n@@ -843,7 +852,7 @@ static void check_good_are_ancestors_of_bad(const char *prefix, int no_checkout)\n \tint fd;\n \n \tif (!current_bad_oid)\n-\t\tdie(\"a %s revision is needed\", term_bad);\n+\t\tdie(_(\"a %s revision is needed\"), _(term_bad));\n \n \t/* Check if file BISECT_ANCESTORS_OK exists. */\n \tif (!stat(filename, &st) && S_ISREG(st.st_mode))\n@@ -860,7 +869,7 @@ static void check_good_are_ancestors_of_bad(const char *prefix, int no_checkout)\n \t/* Create file BISECT_ANCESTORS_OK. */\n \tfd = open(filename, O_CREAT | O_TRUNC | O_WRONLY, 0600);\n \tif (fd < 0)\n-\t\twarning_errno(\"could not create file '%s'\",\n+\t\twarning_errno(_(\"could not create file '%s'\"),\n \t\t\t      filename);\n \telse\n \t\tclose(fd);\n@@ -906,11 +915,11 @@ void read_bisect_terms(const char **read_bad, const char **read_good)\n \n \tif (!fp) {\n \t\tif (errno == ENOENT) {\n-\t\t\t*read_bad = \"bad\";\n-\t\t\t*read_good = \"good\";\n+\t\t\t*read_bad = term_names[BAD];\n+\t\t\t*read_good = term_names[GOOD];\n \t\t\treturn;\n \t\t} else {\n-\t\t\tdie_errno(\"could not read file '%s'\", filename);\n+\t\t\tdie_errno(_(\"could not read file '%s'\"), filename);\n \t\t}\n \t} else {\n \t\tstrbuf_getline_lf(&str, fp);\n@@ -936,10 +945,11 @@ int bisect_next_all(const char *prefix, int no_checkout)\n \tstruct commit_list *tried;\n \tint reaches = 0, all = 0, nr, steps;\n \tconst unsigned char *bisect_rev;\n+\tchar steps_msg[32];\n \n \tread_bisect_terms(&term_bad, &term_good);\n \tif (read_bisect_refs())\n-\t\tdie(\"reading bisect refs failed\");\n+\t\tdie(_(\"reading bisect refs failed\"));\n \n \tcheck_good_are_ancestors_of_bad(prefix, no_checkout);\n \n@@ -959,16 +969,16 @@ int bisect_next_all(const char *prefix, int no_checkout)\n \t\t */\n \t\texit_if_skipped_commits(tried, NULL);\n \n-\t\tprintf(\"%s was both %s and %s\\n\",\n+\t\tprintf(_(\"%s was both %s and %s\\n\"),\n \t\t       oid_to_hex(current_bad_oid),\n-\t\t       term_good,\n-\t\t       term_bad);\n+\t\t       _(term_good),\n+\t\t       _(term_bad));\n \t\texit(1);\n \t}\n \n \tif (!all) {\n-\t\tfprintf(stderr, \"No testable commit found.\\n\"\n-\t\t\t\"Maybe you started with bad path parameters?\\n\");\n+\t\tfprintf(stderr, _(\"No testable commit found.\\n\"\n+\t\t\t\"Maybe you started with bad path parameters?\\n\"));\n \t\texit(4);\n \t}\n \n@@ -985,9 +995,14 @@ int bisect_next_all(const char *prefix, int no_checkout)\n \n \tnr = all - reaches - 1;\n \tsteps = estimate_bisect_steps(all);\n-\tprintf(\"Bisecting: %d revision%s left to test after this \"\n-\t       \"(roughly %d step%s)\\n\", nr, (nr == 1 ? \"\" : \"s\"),\n-\t       steps, (steps == 1 ? \"\" : \"s\"));\n+\txsnprintf(steps_msg, sizeof(steps_msg),\n+\t\t  Q_(\"(roughly %d step)\", \"(roughly %d steps)\", steps),\n+\t\t  steps);\n+\t/* TRANSLATORS: the last %s will be replaced with\n+\t   \"(roughly %d steps)\" translation */\n+\tprintf(Q_(\"Bisecting: %d revision left to test after this %s\\n\",\n+\t\t  \"Bisecting: %d revisions left to test after this %s\\n\",\n+\t\t  nr), nr, steps_msg);\n \n \treturn bisect_checkout(bisect_rev, no_checkout);\n }\ndiff --git a/builtin/apply.c b/builtin/apply.c\nindex 8e4da2e..205c9f8f3 100644\n--- a/builtin/apply.c\n+++ b/builtin/apply.c\n@@ -3226,7 +3226,7 @@ static int load_patch_target(struct strbuf *buf,\n {\n \tif (cached || check_index) {\n \t\tif (read_file_or_gitlink(ce, buf))\n-\t\t\treturn error(_(\"read of %s failed\"), name);\n+\t\t\treturn error(_(\"failed to read %s\"), name);\n \t} else if (name) {\n \t\tif (S_ISGITLINK(expected_mode)) {\n \t\t\tif (ce)\n@@ -3237,7 +3237,7 @@ static int load_patch_target(struct strbuf *buf,\n \t\t\treturn error(_(\"reading from '%s' beyond a symbolic link\"), name);\n \t\t} else {\n \t\t\tif (read_old_data(st, name, buf))\n-\t\t\t\treturn error(_(\"read of %s failed\"), name);\n+\t\t\t\treturn error(_(\"failed to read %s\"), name);\n \t\t}\n \t}\n \treturn 0;\n@@ -3282,7 +3282,7 @@ static int load_preimage(struct image *image,\n \t\t\tfree_fragment_list(patch->fragments);\n \t\t\tpatch->fragments = NULL;\n \t\t} else if (status) {\n-\t\t\treturn error(_(\"read of %s failed\"), patch->old_name);\n+\t\t\treturn error(_(\"failed to read %s\"), patch->old_name);\n \t\t}\n \t}\n \ndiff --git a/builtin/branch.c b/builtin/branch.c\nindex 2ecde53..12203fd 100644\n--- a/builtin/branch.c\n+++ b/builtin/branch.c\n@@ -614,9 +614,9 @@ static int edit_branch_description(const char *branch_name)\n \tif (!buf.len || buf.buf[buf.len-1] != '\\n')\n \t\tstrbuf_addch(&buf, '\\n');\n \tstrbuf_commented_addf(&buf,\n-\t\t    \"Please edit the description for the branch\\n\"\n-\t\t    \"  %s\\n\"\n-\t\t    \"Lines starting with '%c' will be stripped.\\n\",\n+\t\t    _(\"Please edit the description for the branch\\n\"\n+\t\t      \"  %s\\n\"\n+\t\t      \"Lines starting with '%c' will be stripped.\\n\"),\n \t\t    branch_name, comment_line_char);\n \tif (write_file_gently(git_path(edit_description), \"%s\", buf.buf)) {\n \t\tstrbuf_release(&buf);\ndiff --git a/builtin/checkout.c b/builtin/checkout.c\nindex 3398c61..05c7b71 100644\n--- a/builtin/checkout.c\n+++ b/builtin/checkout.c\n@@ -276,7 +276,7 @@ static int checkout_paths(const struct checkout_opts *opts,\n \n \thold_locked_index(lock_file, 1);\n \tif (read_cache_preload(&opts->pathspec) < 0)\n-\t\treturn error(_(\"corrupt index file\"));\n+\t\treturn error(_(\"index file corrupt\"));\n \n \tif (opts->source_tree)\n \t\tread_tree_some(opts->source_tree, &opts->pathspec);\n@@ -470,7 +470,7 @@ static int merge_working_tree(const struct checkout_opts *opts,\n \n \thold_locked_index(lock_file, 1);\n \tif (read_cache_preload(NULL) < 0)\n-\t\treturn error(_(\"corrupt index file\"));\n+\t\treturn error(_(\"index file corrupt\"));\n \n \tresolve_undo_clear();\n \tif (opts->force) {\n@@ -1138,7 +1138,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)\n \t\tOPT_STRING('B', NULL, &opts.new_branch_force, N_(\"branch\"),\n \t\t\t   N_(\"create/reset and checkout a branch\")),\n \t\tOPT_BOOL('l', NULL, &opts.new_branch_log, N_(\"create reflog for new branch\")),\n-\t\tOPT_BOOL(0, \"detach\", &opts.force_detach, N_(\"detach the HEAD at named commit\")),\n+\t\tOPT_BOOL(0, \"detach\", &opts.force_detach, N_(\"detach HEAD at named commit\")),\n \t\tOPT_SET_INT('t', \"track\",  &opts.track, N_(\"set upstream info for new branch\"),\n \t\t\tBRANCH_TRACK_EXPLICIT),\n \t\tOPT_STRING(0, \"orphan\", &opts.new_orphan_branch, N_(\"new-branch\"), N_(\"new unparented branch\")),\ndiff --git a/builtin/init-db.c b/builtin/init-db.c\nindex b2d8d40..3a45f0b 100644\n--- a/builtin/init-db.c\n+++ b/builtin/init-db.c\n@@ -397,13 +397,16 @@ int init_db(const char *template_dir, unsigned int flags)\n \tif (!(flags & INIT_DB_QUIET)) {\n \t\tint len = strlen(git_dir);\n \n-\t\t/* TRANSLATORS: The first '%s' is either \"Reinitialized\n-\t\t   existing\" or \"Initialized empty\", the second \" shared\" or\n-\t\t   \"\", and the last '%s%s' is the verbatim directory name. */\n-\t\tprintf(_(\"%s%s Git repository in %s%s\\n\"),\n-\t\t       reinit ? _(\"Reinitialized existing\") : _(\"Initialized empty\"),\n-\t\t       get_shared_repository() ? _(\" shared\") : \"\",\n-\t\t       git_dir, len && git_dir[len-1] != '/' ? \"/\" : \"\");\n+\t\tif (reinit)\n+\t\t\tprintf(get_shared_repository()\n+\t\t\t       ? _(\"Reinitialized existing shared Git repository in %s%s\\n\")\n+\t\t\t       : _(\"Reinitialized existing Git repository in %s%s\\n\"),\n+\t\t\t       git_dir, len && git_dir[len-1] != '/' ? \"/\" : \"\");\n+\t\telse\n+\t\t\tprintf(get_shared_repository()\n+\t\t\t       ? _(\"Initialized empty shared Git repository in %s%s\\n\")\n+\t\t\t       : _(\"Initialized empty Git repository in %s%s\\n\"),\n+\t\t\t       git_dir, len && git_dir[len-1] != '/' ? \"/\" : \"\");\n \t}\n \n \treturn 0;\ndiff --git a/builtin/merge.c b/builtin/merge.c\nindex b555a1b..d82f6c1 100644\n--- a/builtin/merge.c\n+++ b/builtin/merge.c\n@@ -211,7 +211,7 @@ static struct option builtin_merge_options[] = {\n \t\tPARSE_OPT_NOARG | PARSE_OPT_NONEG, NULL, FF_ONLY },\n \tOPT_RERERE_AUTOUPDATE(&allow_rerere_auto),\n \tOPT_BOOL(0, \"verify-signatures\", &verify_signatures,\n-\t\tN_(\"Verify that the named commit has a valid GPG signature\")),\n+\t\tN_(\"verify that the named commit has a valid GPG signature\")),\n \tOPT_CALLBACK('s', \"strategy\", &use_strategies, N_(\"strategy\"),\n \t\tN_(\"merge strategy to use\"), option_parse_strategy),\n \tOPT_CALLBACK('X', \"strategy-option\", &xopts, N_(\"option=value\"),\n@@ -1014,7 +1014,7 @@ static int default_edit_option(void)\n \tif (e) {\n \t\tint v = git_config_maybe_bool(name, e);\n \t\tif (v < 0)\n-\t\t\tdie(\"Bad value '%s' in environment '%s'\", e, name);\n+\t\t\tdie(_(\"Bad value '%s' in environment '%s'\"), e, name);\n \t\treturn v;\n \t}\n \n@@ -1115,7 +1115,7 @@ static void handle_fetch_head(struct commit_list **remotes, struct strbuf *merge\n \t\tif (!commit) {\n \t\t\tif (ptr)\n \t\t\t\t*ptr = '\\0';\n-\t\t\tdie(\"not something we can merge in %s: %s\",\n+\t\t\tdie(_(\"not something we can merge in %s: %s\"),\n \t\t\t    filename, merge_names->buf + pos);\n \t\t}\n \t\tremotes = &commit_list_insert(commit, remotes)->next;\n@@ -1149,7 +1149,7 @@ static struct commit_list *collect_parents(struct commit *head_commit,\n \t\t\tstruct commit *commit = get_merge_parent(argv[i]);\n \t\t\tif (!commit)\n \t\t\t\thelp_unknown_ref(argv[i], \"merge\",\n-\t\t\t\t\t\t \"not something we can merge\");\n+\t\t\t\t\t\t _(\"not something we can merge\"));\n \t\t\tremotes = &commit_list_insert(commit, remotes)->next;\n \t\t}\n \t\tremoteheads = reduce_parents(head_commit, head_subsumed, remoteheads);\n@@ -1421,7 +1421,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)\n \t\t * If head can reach all the merge then we are up to date.\n \t\t * but first the most common case of merging one remote.\n \t\t */\n-\t\tfinish_up_to_date(\"Already up-to-date.\");\n+\t\tfinish_up_to_date(_(\"Already up-to-date.\"));\n \t\tgoto done;\n \t} else if (fast_forward != FF_NO && !remoteheads->next &&\n \t\t\t!common->next &&\n@@ -1506,7 +1506,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)\n \t\t\t}\n \t\t}\n \t\tif (up_to_date) {\n-\t\t\tfinish_up_to_date(\"Already up-to-date. Yeeah!\");\n+\t\t\tfinish_up_to_date(_(\"Already up-to-date. Yeeah!\"));\n \t\t\tgoto done;\n \t\t}\n \t}\ndiff --git a/builtin/notes.c b/builtin/notes.c\nindex c65b59a..0572051 100644\n--- a/builtin/notes.c\n+++ b/builtin/notes.c\n@@ -749,7 +749,7 @@ static int git_config_get_notes_strategy(const char *key,\n \tif (git_config_get_string(key, &value))\n \t\treturn 1;\n \tif (parse_notes_merge_strategy(value, strategy))\n-\t\tgit_die_config(key, \"unknown notes merge strategy %s\", value);\n+\t\tgit_die_config(key, _(\"unknown notes merge strategy %s\"), value);\n \n \tfree(value);\n \treturn 0;\n@@ -788,15 +788,15 @@ static int merge(int argc, const char **argv, const char *prefix)\n \tif (strategy || do_commit + do_abort == 0)\n \t\tdo_merge = 1;\n \tif (do_merge + do_commit + do_abort != 1) {\n-\t\terror(\"cannot mix --commit, --abort or -s/--strategy\");\n+\t\terror(_(\"cannot mix --commit, --abort or -s/--strategy\"));\n \t\tusage_with_options(git_notes_merge_usage, options);\n \t}\n \n \tif (do_merge && argc != 1) {\n-\t\terror(\"Must specify a notes ref to merge\");\n+\t\terror(_(\"Must specify a notes ref to merge\"));\n \t\tusage_with_options(git_notes_merge_usage, options);\n \t} else if (!do_merge && argc) {\n-\t\terror(\"too many parameters\");\n+\t\terror(_(\"too many parameters\"));\n \t\tusage_with_options(git_notes_merge_usage, options);\n \t}\n \n@@ -817,7 +817,7 @@ static int merge(int argc, const char **argv, const char *prefix)\n \n \tif (strategy) {\n \t\tif (parse_notes_merge_strategy(strategy, &o.strategy)) {\n-\t\t\terror(\"Unknown -s/--strategy: %s\", strategy);\n+\t\t\terror(_(\"Unknown -s/--strategy: %s\"), strategy);\n \t\t\tusage_with_options(git_notes_merge_usage, options);\n \t\t}\n \t} else {\n@@ -857,11 +857,11 @@ static int merge(int argc, const char **argv, const char *prefix)\n \t\t\tdie(_(\"A notes merge into %s is already in-progress at %s\"),\n \t\t\t    default_notes_ref(), wt->path);\n \t\tif (create_symref(\"NOTES_MERGE_REF\", default_notes_ref(), NULL))\n-\t\t\tdie(\"Failed to store link to current notes ref (%s)\",\n+\t\t\tdie(_(\"Failed to store link to current notes ref (%s)\"),\n \t\t\t    default_notes_ref());\n-\t\tprintf(\"Automatic notes merge failed. Fix conflicts in %s and \"\n-\t\t       \"commit the result with 'git notes merge --commit', or \"\n-\t\t       \"abort the merge with 'git notes merge --abort'.\\n\",\n+\t\tprintf(_(\"Automatic notes merge failed. Fix conflicts in %s and \"\n+\t\t\t \"commit the result with 'git notes merge --commit', or \"\n+\t\t\t \"abort the merge with 'git notes merge --abort'.\\n\"),\n \t\t       git_path(NOTES_MERGE_WORKTREE));\n \t}\n \n@@ -934,8 +934,8 @@ static int prune(int argc, const char **argv, const char *prefix)\n \tstruct notes_tree *t;\n \tint show_only = 0, verbose = 0;\n \tstruct option options[] = {\n-\t\tOPT__DRY_RUN(&show_only, \"do not remove, show only\"),\n-\t\tOPT__VERBOSE(&verbose, \"report pruned notes\"),\n+\t\tOPT__DRY_RUN(&show_only, N_(\"do not remove, show only\")),\n+\t\tOPT__VERBOSE(&verbose, N_(\"report pruned notes\")),\n \t\tOPT_END()\n \t};\n \n@@ -964,7 +964,7 @@ static int get_ref(int argc, const char **argv, const char *prefix)\n \t\t\t     git_notes_get_ref_usage, 0);\n \n \tif (argc) {\n-\t\terror(\"too many parameters\");\n+\t\terror(_(\"too many parameters\"));\n \t\tusage_with_options(git_notes_get_ref_usage, options);\n \t}\n \ndiff --git a/builtin/remote.c b/builtin/remote.c\nindex ae74da6..7f0f78b 100644\n--- a/builtin/remote.c\n+++ b/builtin/remote.c\n@@ -952,7 +952,7 @@ static int show_local_info_item(struct string_list_item *item, void *cb_data)\n \tstruct show_info *show_info = cb_data;\n \tstruct branch_info *branch_info = item->util;\n \tstruct string_list *merge = &branch_info->merge;\n-\tconst char *also;\n+\tint width = show_info->width + 4;\n \tint i;\n \n \tif (branch_info->rebase && branch_info->merge.nr > 1) {\n@@ -969,13 +969,12 @@ static int show_local_info_item(struct string_list_item *item, void *cb_data)\n \t\treturn 0;\n \t} else if (show_info->any_rebase) {\n \t\tprintf_ln(_(\" merges with remote %s\"), merge->items[0].string);\n-\t\talso = _(\"    and with remote\");\n+\t\twidth++;\n \t} else {\n \t\tprintf_ln(_(\"merges with remote %s\"), merge->items[0].string);\n-\t\talso = _(\"   and with remote\");\n \t}\n \tfor (i = 1; i < merge->nr; i++)\n-\t\tprintf(\"    %-*s %s %s\\n\", show_info->width, \"\", also,\n+\t\tprintf(_(\"%-*s    and with remote %s\\n\"), width, \"\",\n \t\t       merge->items[i].string);\n \n \treturn 0;\n@@ -1158,11 +1157,11 @@ static int show(int argc, const char **argv)\n \t\t\t   the one in \"  Fetch URL: %s\" translation */\n \t\t\tprintf_ln(_(\"  Push  URL: %s\"), url[i]);\n \t\tif (!i)\n-\t\t\tprintf_ln(_(\"  Push  URL: %s\"), \"(no URL)\");\n+\t\t\tprintf_ln(_(\"  Push  URL: %s\"), _(\"(no URL)\"));\n \t\tif (no_query)\n-\t\t\tprintf_ln(_(\"  HEAD branch: %s\"), \"(not queried)\");\n+\t\t\tprintf_ln(_(\"  HEAD branch: %s\"), _(\"(not queried)\"));\n \t\telse if (!states.heads.nr)\n-\t\t\tprintf_ln(_(\"  HEAD branch: %s\"), \"(unknown)\");\n+\t\t\tprintf_ln(_(\"  HEAD branch: %s\"), _(\"(unknown)\"));\n \t\telse if (states.heads.nr == 1)\n \t\t\tprintf_ln(_(\"  HEAD branch: %s\"), states.heads.items[0].string);\n \t\telse {\ndiff --git a/builtin/repack.c b/builtin/repack.c\nindex 858db38..0108819 100644\n--- a/builtin/repack.c\n+++ b/builtin/repack.c\n@@ -378,7 +378,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)\n \t\t\t\t\t  item->string,\n \t\t\t\t\t  exts[ext].name);\n \t\t\tif (remove_path(fname))\n-\t\t\t\twarning(_(\"removing '%s' failed\"), fname);\n+\t\t\t\twarning(_(\"failed to remove '%s'\"), fname);\n \t\t\tfree(fname);\n \t\t}\n \t}\ndiff --git a/cache.h b/cache.h\nindex 6049f86..4bded9a 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -1559,10 +1559,17 @@ struct git_config_source {\n \tconst char *blob;\n };\n \n+enum git_config_origin_type {\n+\tCFG_BLOB,\n+\tCFG_FILE,\n+\tCFG_STDIN,\n+\tCFG_SUBMODULE_BLOB\n+};\n+\n typedef int (*config_fn_t)(const char *, const char *, void *);\n extern int git_default_config(const char *, const char *, void *);\n extern int git_config_from_file(config_fn_t fn, const char *, void *);\n-extern int git_config_from_mem(config_fn_t fn, const char *origin_type,\n+extern int git_config_from_mem(config_fn_t fn, const enum git_config_origin_type,\n \t\t\t\t\tconst char *name, const char *buf, size_t len, void *data);\n extern void git_config_push_parameter(const char *text);\n extern int git_config_from_parameters(config_fn_t fn, void *data);\ndiff --git a/config.c b/config.c\nindex f51c56b..b08a418 100644\n--- a/config.c\n+++ b/config.c\n@@ -24,7 +24,7 @@ struct config_source {\n \t\t\tsize_t pos;\n \t\t} buf;\n \t} u;\n-\tconst char *origin_type;\n+\tenum git_config_origin_type origin_type;\n \tconst char *name;\n \tconst char *path;\n \tint die_on_error;\n@@ -417,6 +417,7 @@ static int git_parse_source(config_fn_t fn, void *data)\n \tint comment = 0;\n \tint baselen = 0;\n \tstruct strbuf *var = &cf->var;\n+\tchar error_msg[128];\n \n \t/* U+FEFF Byte Order Mark in UTF8 */\n \tconst char *bomptr = utf8_bom;\n@@ -471,10 +472,38 @@ static int git_parse_source(config_fn_t fn, void *data)\n \t\tif (get_value(fn, data, var) < 0)\n \t\t\tbreak;\n \t}\n+\n+\tswitch (cf->origin_type) {\n+\tcase CFG_BLOB:\n+\t\txsnprintf(error_msg, sizeof(error_msg),\n+\t\t\t  _(\"bad config line %d in blob %s\"),\n+\t\t\t  cf->linenr, cf->name);\n+\t\tbreak;\n+\tcase CFG_FILE:\n+\t\txsnprintf(error_msg, sizeof(error_msg),\n+\t\t\t  _(\"bad config line %d in file %s\"),\n+\t\t\t  cf->linenr, cf->name);\n+\t\tbreak;\n+\tcase CFG_STDIN:\n+\t\txsnprintf(error_msg, sizeof(error_msg),\n+\t\t\t  _(\"bad config line %d in standard input\"),\n+\t\t\t  cf->linenr);\n+\t\tbreak;\n+\tcase CFG_SUBMODULE_BLOB:\n+\t\txsnprintf(error_msg, sizeof(error_msg),\n+\t\t\t  _(\"bad config line %d in submodule-blob %s\"),\n+\t\t\t  cf->linenr, cf->name);\n+\t\tbreak;\n+\tdefault:\n+\t\txsnprintf(error_msg, sizeof(error_msg),\n+\t\t\t  _(\"bad config line %d in %s\"),\n+\t\t\t  cf->linenr, cf->name);\n+\t}\n+\n \tif (cf->die_on_error)\n-\t\tdie(_(\"bad config line %d in %s %s\"), cf->linenr, cf->origin_type, cf->name);\n+\t\tdie(error_msg);\n \telse\n-\t\treturn error(_(\"bad config line %d in %s %s\"), cf->linenr, cf->origin_type, cf->name);\n+\t\treturn error(error_msg);\n }\n \n static int parse_unit_factor(const char *end, uintmax_t *val)\n@@ -583,16 +612,42 @@ int git_parse_ulong(const char *value, unsigned long *ret)\n NORETURN\n static void die_bad_number(const char *name, const char *value)\n {\n-\tconst char *reason = errno == ERANGE ?\n-\t\t\t     \"out of range\" :\n-\t\t\t     \"invalid unit\";\n \tif (!value)\n \t\tvalue = \"\";\n \n-\tif (cf && cf->origin_type && cf->name)\n-\t\tdie(_(\"bad numeric config value '%s' for '%s' in %s %s: %s\"),\n-\t\t    value, name, cf->origin_type, cf->name, reason);\n-\tdie(_(\"bad numeric config value '%s' for '%s': %s\"), value, name, reason);\n+\tif (!(cf && cf->name))\n+\t\tdie(errno == ERANGE\n+\t\t    ? _(\"bad numeric config value '%s' for '%s': out of range\")\n+\t\t    : _(\"bad numeric config value '%s' for '%s': invalid unit\"),\n+\t\t    value, name);\n+\n+\tswitch (cf->origin_type) {\n+\tcase CFG_BLOB:\n+\t\tdie(errno == ERANGE\n+\t\t    ? _(\"bad numeric config value '%s' for '%s' in blob %s: out of range\")\n+\t\t    : _(\"bad numeric config value '%s' for '%s' in blob %s: invalid unit\"),\n+\t\t    value, name, cf->name);\n+\tcase CFG_FILE:\n+\t\tdie(errno == ERANGE\n+\t\t    ? _(\"bad numeric config value '%s' for '%s' in file %s: out of range\")\n+\t\t    : _(\"bad numeric config value '%s' for '%s' in file %s: invalid unit\"),\n+\t\t    value, name, cf->name);\n+\tcase CFG_STDIN:\n+\t\tdie(errno == ERANGE\n+\t\t    ? _(\"bad numeric config value '%s' for '%s' in standard input: out of range\")\n+\t\t    : _(\"bad numeric config value '%s' for '%s' in standard input: invalid unit\"),\n+\t\t    value, name);\n+\tcase CFG_SUBMODULE_BLOB:\n+\t\tdie(errno == ERANGE\n+\t\t    ? _(\"bad numeric config value '%s' for '%s' in submodule-blob %s: out of range\")\n+\t\t    : _(\"bad numeric config value '%s' for '%s' in submodule-blob %s: invalid unit\"),\n+\t\t    value, name, cf->name);\n+\tdefault:\n+\t\tdie(errno == ERANGE\n+\t\t    ? _(\"bad numeric config value '%s' for '%s' in %s: out of range\")\n+\t\t    : _(\"bad numeric config value '%s' for '%s' in %s: invalid unit\"),\n+\t\t    value, name, cf->name);\n+\t}\n }\n \n int git_config_int(const char *name, const char *value)\n@@ -1069,7 +1124,8 @@ static int do_config_from(struct config_source *top, config_fn_t fn, void *data)\n }\n \n static int do_config_from_file(config_fn_t fn,\n-\t\tconst char *origin_type, const char *name, const char *path, FILE *f,\n+\t\tconst enum git_config_origin_type origin_type,\n+\t\tconst char *name, const char *path, FILE *f,\n \t\tvoid *data)\n {\n \tstruct config_source top;\n@@ -1088,7 +1144,7 @@ static int do_config_from_file(config_fn_t fn,\n \n static int git_config_from_stdin(config_fn_t fn, void *data)\n {\n-\treturn do_config_from_file(fn, \"standard input\", \"\", NULL, stdin, data);\n+\treturn do_config_from_file(fn, CFG_STDIN, \"\", NULL, stdin, data);\n }\n \n int git_config_from_file(config_fn_t fn, const char *filename, void *data)\n@@ -1099,14 +1155,14 @@ int git_config_from_file(config_fn_t fn, const char *filename, void *data)\n \tf = fopen(filename, \"r\");\n \tif (f) {\n \t\tflockfile(f);\n-\t\tret = do_config_from_file(fn, \"file\", filename, filename, f, data);\n+\t\tret = do_config_from_file(fn, CFG_FILE, filename, filename, f, data);\n \t\tfunlockfile(f);\n \t\tfclose(f);\n \t}\n \treturn ret;\n }\n \n-int git_config_from_mem(config_fn_t fn, const char *origin_type,\n+int git_config_from_mem(config_fn_t fn, const enum git_config_origin_type origin_type,\n \t\t\tconst char *name, const char *buf, size_t len, void *data)\n {\n \tstruct config_source top;\n@@ -1143,7 +1199,7 @@ static int git_config_from_blob_sha1(config_fn_t fn,\n \t\treturn error(\"reference '%s' does not point to a blob\", name);\n \t}\n \n-\tret = git_config_from_mem(fn, \"blob\", name, buf, size, data);\n+\tret = git_config_from_mem(fn, CFG_BLOB, name, buf, size, data);\n \tfree(buf);\n \n \treturn ret;\n@@ -2442,7 +2498,21 @@ int parse_config_key(const char *var,\n \n const char *current_config_origin_type(void)\n {\n-\treturn cf && cf->origin_type ? cf->origin_type : \"command line\";\n+\tif (!cf)\n+\t\treturn \"command line\";\n+\n+\tswitch (cf->origin_type) {\n+\tcase CFG_BLOB:\n+\t\treturn \"blob\";\n+\tcase CFG_FILE:\n+\t\treturn \"file\";\n+\tcase CFG_STDIN:\n+\t\treturn \"standard input\";\n+\tcase CFG_SUBMODULE_BLOB:\n+\t\treturn \"submodule-blob\";\n+\tdefault:\n+\t\treturn \"command line\";\n+\t}\n }\n \n const char *current_config_name(void)\ndiff --git a/git-bisect.sh b/git-bisect.sh\nindex 737bf05..c9acab6 100755\n--- a/git-bisect.sh\n+++ b/git-bisect.sh\n@@ -275,7 +275,7 @@ bisect_state() {\n \tcheck_and_set_terms $state\n \tcase \"$#,$state\" in\n \t0,*)\n-\t\tdie \"$(gettext \"Please call 'bisect_state' with at least one argument.\")\" ;;\n+\t\tdie \"Please call 'bisect_state' with at least one argument.\" ;;\n \t1,\"$TERM_BAD\"|1,\"$TERM_GOOD\"|1,skip)\n \t\tbisected_head=$(bisect_head)\n \t\trev=$(git rev-parse --verify \"$bisected_head\") ||\ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex caf4aa1..a545d92 100644\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -222,11 +222,12 @@ has_action () {\n }\n \n is_empty_commit() {\n-\tsha1=$1\n-\ttree=$(git rev-parse -q --verify \"$sha1\"^{tree} 2>/dev/null ||\n-\t\tdie \"$(eval_gettext \"\\$sha1: not a commit that can be picked\")\")\n-\tptree=$(git rev-parse -q --verify \"$sha1\"^^{tree} 2>/dev/null ||\n-\t\tptree=4b825dc642cb6eb9a060e54bf8d69288fbee4904)\n+\ttree=$(git rev-parse -q --verify \"$1\"^{tree} 2>/dev/null) || {\n+\t\tsha1=$1\n+\t\tdie \"$(eval_gettext \"\\$sha1: not a commit that can be picked\")\"\n+\t}\n+\tptree=$(git rev-parse -q --verify \"$1\"^^{tree} 2>/dev/null) ||\n+\t\tptree=4b825dc642cb6eb9a060e54bf8d69288fbee4904\n \ttest \"$tree\" = \"$ptree\"\n }\n \ndiff --git a/git-sh-i18n.sh b/git-sh-i18n.sh\nindex c14c303..1ef1889 100644\n--- a/git-sh-i18n.sh\n+++ b/git-sh-i18n.sh\n@@ -53,6 +53,13 @@ gettext_without_eval_gettext)\n \t\t\tgit sh-i18n--envsubst \"$1\"\n \t\t)\n \t}\n+\n+\teval_ngettext () {\n+\t\tngettext \"$1\" \"$2\" \"$3\" | (\n+\t\t\texport PATH $(git sh-i18n--envsubst --variables \"$2\");\n+\t\t\tgit sh-i18n--envsubst \"$2\"\n+\t\t)\n+\t}\n \t;;\n poison)\n \t# Emit garbage so that tests that incorrectly rely on translatable\n@@ -80,6 +87,13 @@ poison)\n \t\t\tgit sh-i18n--envsubst \"$1\"\n \t\t)\n \t}\n+\n+\teval_ngettext () {\n+\t\t(test \"$3\" = 1 && printf \"%s\" \"$1\" || printf \"%s\" \"$2\") | (\n+\t\t\texport PATH $(git sh-i18n--envsubst --variables \"$2\");\n+\t\t\tgit sh-i18n--envsubst \"$2\"\n+\t\t)\n+\t}\n \t;;\n esac\n \ndiff --git a/git-sh-setup.sh b/git-sh-setup.sh\nindex 55efa23..61a3d95 100644\n--- a/git-sh-setup.sh\n+++ b/git-sh-setup.sh\n@@ -192,32 +192,35 @@ cd_to_toplevel () {\n }\n \n require_work_tree_exists () {\n-\tprogram_name=$0\n \tif test \"z$(git rev-parse --is-bare-repository)\" != zfalse\n \tthen\n+\t\tprogram_name=$0\n \t\tdie \"$(gettext \"fatal: \\$program_name cannot be used without a working tree.\")\"\n \tfi\n }\n \n require_work_tree () {\n-\tprogram_name=$0\n-\ttest \"$(git rev-parse --is-inside-work-tree 2>/dev/null)\" = true ||\n+\ttest \"$(git rev-parse --is-inside-work-tree 2>/dev/null)\" = true || {\n+\t\tprogram_name=$0\n \t\tdie \"$(gettext \"fatal: \\$program_name cannot be used without a working tree.\")\"\n+\t}\n }\n \n require_clean_work_tree () {\n-\taction=$1\n-\thint=$2\n \tgit rev-parse --verify HEAD >/dev/null || exit 1\n \tgit update-index -q --ignore-submodules --refresh\n \terr=0\n \n \tif ! git diff-files --quiet --ignore-submodules\n \tthen\n+\t\taction=$1\n \t\tcase \"$action\" in\n \t\trebase)\n \t\t\tgettextln \"Cannot rebase: You have unstaged changes.\" >&2\n \t\t\t;;\n+\t\t\"rewrite branches\")\n+\t\t\tgettextln \"Cannot rewrite branches: You have unstaged changes.\" >&2\n+\t\t\t;;\n \t\t\"pull with rebase\")\n \t\t\tgettextln \"Cannot pull with rebase: You have unstaged changes.\" >&2\n \t\t\t;;\n@@ -232,6 +235,7 @@ require_clean_work_tree () {\n \tthen\n \t\tif test $err = 0\n \t\tthen\n+\t\t\taction=$1\n \t\t\tcase \"$action\" in\n \t\t\trebase)\n \t\t\t\tgettextln \"Cannot rebase: Your index contains uncommitted changes.\" >&2\n@@ -251,7 +255,7 @@ require_clean_work_tree () {\n \n \tif test $err = 1\n \tthen\n-\t\ttest -n \"$hint\" && echo \"$2\" >&2\n+\t\ttest -n \"$2\" && echo \"$2\" >&2\n \t\texit 1\n \tfi\n }\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex 5a4dec0..75a7ebe 100755\n--- a/git-submodule.sh\n+++ b/git-submodule.sh\n@@ -275,14 +275,15 @@ Use -f if you really want to add it.\" >&2\n \t\tthen\n \t\t\tif test -z \"$force\"\n \t\t\tthen\n-\t\t\t\techo >&2 \"$(eval_gettext \"A git directory for '\\$sm_name' is found locally with remote(s):\")\"\n+\t\t\t\teval_gettextln >&2 \"A git directory for '\\$sm_name' is found locally with remote(s):\"\n \t\t\t\tGIT_DIR=\".git/modules/$sm_name\" GIT_WORK_TREE=. git remote -v | grep '(fetch)' | sed -e s,^,\"  \", -e s,' (fetch)',, >&2\n-\t\t\t\techo >&2 \"$(eval_gettext \"If you want to reuse this local git directory instead of cloning again from\")\"\n-\t\t\t\techo >&2 \"  $realrepo\"\n-\t\t\t\techo >&2 \"$(eval_gettext \"use the '--force' option. If the local git directory is not the correct repo\")\"\n-\t\t\t\tdie \"$(eval_gettext \"or you are unsure what this means choose another name with the '--name' option.\")\"\n+\t\t\t\tdie \"$(eval_gettextln \"\\\n+If you want to reuse this local git directory instead of cloning again from\n+  \\$realrepo\n+use the '--force' option. If the local git directory is not the correct repo\n+or you are unsure what this means choose another name with the '--name' option.\")\"\n \t\t\telse\n-\t\t\t\techo \"$(eval_gettext \"Reactivating local git directory for submodule '\\$sm_name'.\")\"\n+\t\t\t\teval_gettextln \"Reactivating local git directory for submodule '\\$sm_name'.\"\n \t\t\tfi\n \t\tfi\n \t\tgit submodule--helper clone ${GIT_QUIET:+--quiet} --prefix \"$wt_prefix\" --path \"$sm_path\" --name \"$sm_name\" --url \"$realrepo\" ${reference:+\"$reference\"} ${depth:+\"$depth\"} || exit\n@@ -467,8 +468,9 @@ cmd_deinit()\n \t\t\t# Protect submodules containing a .git directory\n \t\t\tif test -d \"$sm_path/.git\"\n \t\t\tthen\n-\t\t\t\techo >&2 \"$(eval_gettext \"Submodule work tree '\\$displaypath' contains a .git directory\")\"\n-\t\t\t\tdie \"$(eval_gettext \"(use 'rm -rf' if you really want to remove it including all of its history)\")\"\n+\t\t\t\tdie \"$(eval_gettext \"\\\n+Submodule work tree '\\$displaypath' contains a .git directory\n+(use 'rm -rf' if you really want to remove it including all of its history)\")\"\n \t\t\tfi\n \n \t\t\tif test -z \"$force\"\n@@ -646,7 +648,7 @@ cmd_update()\n \t\t\tremote_name=$(sanitize_submodule_env; cd \"$sm_path\" && get_default_remote)\n \t\t\tsha1=$(sanitize_submodule_env; cd \"$sm_path\" &&\n \t\t\t\tgit rev-parse --verify \"${remote_name}/${branch}\") ||\n-\t\t\tdie \"$(eval_gettext \"Unable to find current ${remote_name}/${branch} revision in submodule path '\\$sm_path'\")\"\n+\t\t\tdie \"$(eval_gettext \"Unable to find current \\${remote_name}/\\${branch} revision in submodule path '\\$sm_path'\")\"\n \t\tfi\n \n \t\tif test \"$subsha1\" != \"$sha1\" || test -n \"$force\"\n@@ -670,7 +672,7 @@ cmd_update()\n \t\t\t\t# not be reachable from any of the refs\n \t\t\t\tis_tip_reachable \"$sm_path\" \"$sha1\" ||\n \t\t\t\tfetch_in_submodule \"$sm_path\" \"$sha1\" ||\n-\t\t\t\tdie \"$(eval_gettext \"Fetched in submodule path '\\$displaypath', but it did not contain $sha1. Direct fetching of that commit failed.\")\"\n+\t\t\t\tdie \"$(eval_gettext \"Fetched in submodule path '\\$displaypath', but it did not contain \\$sha1. Direct fetching of that commit failed.\")\"\n \t\t\tfi\n \n \t\t\tmust_die_on_failure=\ndiff --git a/sequencer.c b/sequencer.c\nindex 57b3671..e916387 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -190,7 +190,7 @@ static void write_message(struct strbuf *msgbuf, const char *filename)\n \t\tdie_errno(_(\"Could not write to %s\"), filename);\n \tstrbuf_release(msgbuf);\n \tif (commit_lock_file(&msg_file) < 0)\n-\t\tdie(_(\"Error wrapping up %s\"), filename);\n+\t\tdie(_(\"Error wrapping up %s.\"), filename);\n }\n \n static struct tree *empty_tree(void)\ndiff --git a/submodule-config.c b/submodule-config.c\nindex debab29..f53f6bd 100644\n--- a/submodule-config.c\n+++ b/submodule-config.c\n@@ -439,7 +439,7 @@ static const struct submodule *config_from(struct submodule_cache *cache,\n \tparameter.commit_sha1 = commit_sha1;\n \tparameter.gitmodules_sha1 = sha1;\n \tparameter.overwrite = 0;\n-\tgit_config_from_mem(parse_config, \"submodule-blob\", rev.buf,\n+\tgit_config_from_mem(parse_config, CFG_SUBMODULE_BLOB, rev.buf,\n \t\t\tconfig, config_size, &parameter);\n \tfree(config);\n \ndiff --git a/t/t1307-config-blob.sh b/t/t1307-config-blob.sh\nindex 4079fef..eed31ff 100755\n--- a/t/t1307-config-blob.sh\n+++ b/t/t1307-config-blob.sh\n@@ -61,9 +61,6 @@ test_expect_success 'parse errors in blobs are properly attributed' '\n \tgit commit -m broken &&\n \n \ttest_must_fail git config --blob=HEAD:config some.value 2>err &&\n-\n-\t# just grep for our token as the exact error message is likely to\n-\t# change or be internationalized\n \ttest_i18ngrep \"HEAD:config\" err\n '\n \ndiff --git a/t/t3310-notes-merge-manual-resolve.sh b/t/t3310-notes-merge-manual-resolve.sh\nindex d557212..6967436 100755\n--- a/t/t3310-notes-merge-manual-resolve.sh\n+++ b/t/t3310-notes-merge-manual-resolve.sh\n@@ -178,7 +178,7 @@ test_expect_success 'merge z into m (== y) with default (\"manual\") resolver => C\n \tgit config core.notesRef refs/notes/m &&\n \ttest_must_fail git notes merge z >output &&\n \t# Output should point to where to resolve conflicts\n-\tgrep -q \"\\\\.git/NOTES_MERGE_WORKTREE\" output &&\n+\ttest_i18ngrep \"\\\\.git/NOTES_MERGE_WORKTREE\" output &&\n \t# Inspect merge conflicts\n \tls .git/NOTES_MERGE_WORKTREE >output_conflicts &&\n \ttest_cmp expect_conflicts output_conflicts &&\n@@ -381,7 +381,7 @@ test_expect_success 'redo merge of z into m (== y) with default (\"manual\") resol\n \tgit config core.notesRef refs/notes/m &&\n \ttest_must_fail git notes merge z >output &&\n \t# Output should point to where to resolve conflicts\n-\tgrep -q \"\\\\.git/NOTES_MERGE_WORKTREE\" output &&\n+\ttest_i18ngrep \"\\\\.git/NOTES_MERGE_WORKTREE\" output &&\n \t# Inspect merge conflicts\n \tls .git/NOTES_MERGE_WORKTREE >output_conflicts &&\n \ttest_cmp expect_conflicts output_conflicts &&\n@@ -415,7 +415,7 @@ git rev-parse refs/notes/z > pre_merge_z\n test_expect_success 'redo merge of z into m (== y) with default (\"manual\") resolver => Conflicting 3-way merge' '\n \ttest_must_fail git notes merge z >output &&\n \t# Output should point to where to resolve conflicts\n-\tgrep -q \"\\\\.git/NOTES_MERGE_WORKTREE\" output &&\n+\ttest_i18ngrep \"\\\\.git/NOTES_MERGE_WORKTREE\" output &&\n \t# Inspect merge conflicts\n \tls .git/NOTES_MERGE_WORKTREE >output_conflicts &&\n \ttest_cmp expect_conflicts output_conflicts &&\n@@ -496,7 +496,7 @@ test_expect_success 'redo merge of z into m (== y) with default (\"manual\") resol\n \tgit update-ref refs/notes/m refs/notes/y &&\n \ttest_must_fail git notes merge z >output &&\n \t# Output should point to where to resolve conflicts\n-\tgrep -q \"\\\\.git/NOTES_MERGE_WORKTREE\" output &&\n+\ttest_i18ngrep \"\\\\.git/NOTES_MERGE_WORKTREE\" output &&\n \t# Inspect merge conflicts\n \tls .git/NOTES_MERGE_WORKTREE >output_conflicts &&\n \ttest_cmp expect_conflicts output_conflicts &&\ndiff --git a/t/t3320-notes-merge-worktrees.sh b/t/t3320-notes-merge-worktrees.sh\nindex 522157b..6e05115 100755\n--- a/t/t3320-notes-merge-worktrees.sh\n+++ b/t/t3320-notes-merge-worktrees.sh\n@@ -62,7 +62,7 @@ test_expect_success 'merge z into x while mid-merge on y succeeds' '\n \t\tcd worktree2 &&\n \t\tgit config core.notesRef refs/notes/x &&\n \t\ttest_must_fail git notes merge z 2>&1 >out &&\n-\t\tgrep \"Automatic notes merge failed\" out &&\n+\t\ttest_i18ngrep \"Automatic notes merge failed\" out &&\n \t\tgrep -v \"A notes merge into refs/notes/x is already in-progress in\" out\n \t) &&\n \techo \"ref: refs/notes/x\" >expect &&\ndiff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh\nindex 7012011..86d1380 100755\n--- a/t/t6030-bisect-porcelain.sh\n+++ b/t/t6030-bisect-porcelain.sh\n@@ -362,7 +362,7 @@ test_expect_success 'bisect starting with a detached HEAD' '\n test_expect_success 'bisect errors out if bad and good are mistaken' '\n \tgit bisect reset &&\n \ttest_must_fail git bisect start $HASH2 $HASH4 2> rev_list_error &&\n-\tgrep \"mistook good and bad\" rev_list_error &&\n+\ttest_i18ngrep \"mistook good and bad\" rev_list_error &&\n \tgit bisect reset\n '\n \n@@ -404,7 +404,7 @@ test_expect_success 'side branch creation' '\n \n test_expect_success 'good merge base when good and bad are siblings' '\n \tgit bisect start \"$HASH7\" \"$SIDE_HASH7\" > my_bisect_log.txt &&\n-\tgrep \"merge base must be tested\" my_bisect_log.txt &&\n+\ttest_i18ngrep \"merge base must be tested\" my_bisect_log.txt &&\n \tgrep $HASH4 my_bisect_log.txt &&\n \tgit bisect good > my_bisect_log.txt &&\n \ttest_must_fail grep \"merge base must be tested\" my_bisect_log.txt &&\n@@ -413,7 +413,7 @@ test_expect_success 'good merge base when good and bad are siblings' '\n '\n test_expect_success 'skipped merge base when good and bad are siblings' '\n \tgit bisect start \"$SIDE_HASH7\" \"$HASH7\" > my_bisect_log.txt &&\n-\tgrep \"merge base must be tested\" my_bisect_log.txt &&\n+\ttest_i18ngrep \"merge base must be tested\" my_bisect_log.txt &&\n \tgrep $HASH4 my_bisect_log.txt &&\n \tgit bisect skip > my_bisect_log.txt 2>&1 &&\n \tgrep \"warning\" my_bisect_log.txt &&\n@@ -423,11 +423,11 @@ test_expect_success 'skipped merge base when good and bad are siblings' '\n \n test_expect_success 'bad merge base when good and bad are siblings' '\n \tgit bisect start \"$HASH7\" HEAD > my_bisect_log.txt &&\n-\tgrep \"merge base must be tested\" my_bisect_log.txt &&\n+\ttest_i18ngrep \"merge base must be tested\" my_bisect_log.txt &&\n \tgrep $HASH4 my_bisect_log.txt &&\n \ttest_must_fail git bisect bad > my_bisect_log.txt 2>&1 &&\n-\tgrep \"merge base $HASH4 is bad\" my_bisect_log.txt &&\n-\tgrep \"fixed between $HASH4 and \\[$SIDE_HASH7\\]\" my_bisect_log.txt &&\n+\ttest_i18ngrep \"merge base $HASH4 is bad\" my_bisect_log.txt &&\n+\ttest_i18ngrep \"fixed between $HASH4 and \\[$SIDE_HASH7\\]\" my_bisect_log.txt &&\n \tgit bisect reset\n '\n \n@@ -460,9 +460,9 @@ test_expect_success 'many merge bases creation' '\n \n test_expect_success 'good merge bases when good and bad are siblings' '\n \tgit bisect start \"$B_HASH\" \"$A_HASH\" > my_bisect_log.txt &&\n-\tgrep \"merge base must be tested\" my_bisect_log.txt &&\n+\ttest_i18ngrep \"merge base must be tested\" my_bisect_log.txt &&\n \tgit bisect good > my_bisect_log2.txt &&\n-\tgrep \"merge base must be tested\" my_bisect_log2.txt &&\n+\ttest_i18ngrep \"merge base must be tested\" my_bisect_log2.txt &&\n \t{\n \t\t{\n \t\t\tgrep \"$SIDE_HASH5\" my_bisect_log.txt &&\n@@ -477,14 +477,14 @@ test_expect_success 'good merge bases when good and bad are siblings' '\n \n test_expect_success 'optimized merge base checks' '\n \tgit bisect start \"$HASH7\" \"$SIDE_HASH7\" > my_bisect_log.txt &&\n-\tgrep \"merge base must be tested\" my_bisect_log.txt &&\n+\ttest_i18ngrep \"merge base must be tested\" my_bisect_log.txt &&\n \tgrep \"$HASH4\" my_bisect_log.txt &&\n \tgit bisect good > my_bisect_log2.txt &&\n \ttest -f \".git/BISECT_ANCESTORS_OK\" &&\n \ttest \"$HASH6\" = $(git rev-parse --verify HEAD) &&\n \tgit bisect bad > my_bisect_log3.txt &&\n \tgit bisect good \"$A_HASH\" > my_bisect_log4.txt &&\n-\tgrep \"merge base must be tested\" my_bisect_log4.txt &&\n+\ttest_i18ngrep \"merge base must be tested\" my_bisect_log4.txt &&\n \ttest_must_fail test -f \".git/BISECT_ANCESTORS_OK\"\n '\n \n@@ -562,7 +562,7 @@ test_expect_success 'skipping away from skipped commit' '\n \n test_expect_success 'erroring out when using bad path parameters' '\n \ttest_must_fail git bisect start $PARA_HASH7 $HASH1 -- foobar 2> error.txt &&\n-\tgrep \"bad path parameters\" error.txt\n+\ttest_i18ngrep \"bad path parameters\" error.txt\n '\n \n test_expect_success 'test bisection on bare repo - --no-checkout specified' '\ndiff --git a/t/t7201-co.sh b/t/t7201-co.sh\nindex 8859236..d4b217b 100755\n--- a/t/t7201-co.sh\n+++ b/t/t7201-co.sh\n@@ -257,7 +257,7 @@ test_expect_success 'checkout to detach HEAD' '\n \tgit checkout -f renamer && git clean -f &&\n \tgit checkout renamer^ 2>messages &&\n \ttest_i18ngrep \"HEAD is now at 7329388\" messages &&\n-\ttest_line_count -gt 1 messages &&\n+\t(test_line_count -gt 1 messages || test -n \"$GETTEXT_POISON\") &&\n \tH=$(git rev-parse --verify HEAD) &&\n \tM=$(git show-ref -s --verify refs/heads/master) &&\n \ttest \"z$H\" = \"z$M\" &&\ndiff --git a/transport-helper.c b/transport-helper.c\nindex bd666b2..4208743 100644\n--- a/transport-helper.c\n+++ b/transport-helper.c\n@@ -1038,7 +1038,7 @@ static struct ref *get_refs_list(struct transport *transport, int for_push)\n \t\t\t\t(*tail)->status |= REF_STATUS_UPTODATE;\n \t\t\t\tif (read_ref((*tail)->name,\n \t\t\t\t\t     (*tail)->old_oid.hash) < 0)\n-\t\t\t\t\tdie(N_(\"Could not read ref %s\"),\n+\t\t\t\t\tdie(_(\"Could not read ref %s\"),\n \t\t\t\t\t    (*tail)->name);\n \t\t\t}\n \t\t}\ndiff --git a/wt-status.c b/wt-status.c\nindex 4f27bd6..5a91279 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -263,7 +263,7 @@ static const char *wt_status_unmerged_status_string(int stagemask)\n \tcase 7:\n \t\treturn _(\"both modified:\");\n \tdefault:\n-\t\tdie(_(\"bug: unhandled unmerged status %x\"), stagemask);\n+\t\tdie(\"bug: unhandled unmerged status %x\", stagemask);\n \t}\n }\n \n@@ -388,7 +388,7 @@ static void wt_status_print_change_data(struct wt_status *s,\n \tstatus_printf(s, color(WT_STATUS_HEADER, s), \"\\t\");\n \twhat = wt_status_diff_status_string(status);\n \tif (!what)\n-\t\tdie(_(\"bug: unhandled diff status %c\"), status);\n+\t\tdie(\"bug: unhandled diff status %c\", status);\n \tlen = label_width - utf8_strwidth(what);\n \tassert(len >= 0);\n \tif (status == DIFF_STATUS_COPIED || status == DIFF_STATUS_RENAMED)\n---- 8< ----\n\n-- \n2.7.3\n"},{"id":"288022","messageId":"1464799289-7639-2-git-send-email-vascomalmeida@sapo.pt","threadId":"42506","inReplyTo":"1464799289-7639-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v3 01/39] i18n: builtin/remote.c: fix mark for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-06-01T16:40:51Z","receivedAt":"2016-06-01T16:40:51Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"The second string inside _() was not being extracted for translation by\nxgettext, meaning that, although the string was passed to gettext, there\nwas no translation available.\n\nMark each individual string instead of marking the result of ternary if.\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n builtin/remote.c | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/builtin/remote.c b/builtin/remote.c\nindex d33766b..ae74da6 100644\n--- a/builtin/remote.c\n+++ b/builtin/remote.c\n@@ -963,9 +963,9 @@ static int show_local_info_item(struct string_list_item *item, void *cb_data)\n \n \tprintf(\"    %-*s \", show_info->width, item->string);\n \tif (branch_info->rebase) {\n-\t\tprintf_ln(_(branch_info->rebase == INTERACTIVE_REBASE ?\n-\t\t\t\"rebases interactively onto remote %s\" :\n-\t\t\t\"rebases onto remote %s\"), merge->items[0].string);\n+\t\tprintf_ln(branch_info->rebase == INTERACTIVE_REBASE\n+\t\t\t  ? _(\"rebases interactively onto remote %s\")\n+\t\t\t  : _(\"rebases onto remote %s\"), merge->items[0].string);\n \t\treturn 0;\n \t} else if (show_info->any_rebase) {\n \t\tprintf_ln(_(\" merges with remote %s\"), merge->items[0].string);\n-- \n2.7.3\n"},{"id":"288028","messageId":"1464799289-7639-3-git-send-email-vascomalmeida@sapo.pt","threadId":"42506","inReplyTo":"1464799289-7639-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v3 02/39] i18n: advice: mark string about detached head for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-06-01T16:40:52Z","receivedAt":"2016-06-01T16:40:52Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Mark string with advice seen by the user when in detached head.\n\nUpdate test t7201-co.sh to pass under GETTEXT_POISON build. Pretend\nsuccess if the number of lines of \"git checkout renamer^\" output is not\ngreater than 1 and test are running under GETTEXT_POISON.\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n advice.c      | 6 +++---\n t/t7201-co.sh | 2 +-\n 2 files changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/advice.c b/advice.c\nindex 4dc5cf1..cb445a7 100644\n--- a/advice.c\n+++ b/advice.c\n@@ -106,14 +106,14 @@ void NORETURN die_conclude_merge(void)\n \n void detach_advice(const char *new_name)\n {\n-\tconst char fmt[] =\n-\t\"Note: checking out '%s'.\\n\\n\"\n+\tconst char *fmt =\n+\t_(\"Note: checking out '%s'.\\n\\n\"\n \t\"You are in 'detached HEAD' state. You can look around, make experimental\\n\"\n \t\"changes and commit them, and you can discard any commits you make in this\\n\"\n \t\"state without impacting any branches by performing another checkout.\\n\\n\"\n \t\"If you want to create a new branch to retain commits you create, you may\\n\"\n \t\"do so (now or later) by using -b with the checkout command again. Example:\\n\\n\"\n-\t\"  git checkout -b <new-branch-name>\\n\\n\";\n+\t\"  git checkout -b <new-branch-name>\\n\\n\");\n \n \tfprintf(stderr, fmt, new_name);\n }\ndiff --git a/t/t7201-co.sh b/t/t7201-co.sh\nindex 8859236..d4b217b 100755\n--- a/t/t7201-co.sh\n+++ b/t/t7201-co.sh\n@@ -257,7 +257,7 @@ test_expect_success 'checkout to detach HEAD' '\n \tgit checkout -f renamer && git clean -f &&\n \tgit checkout renamer^ 2>messages &&\n \ttest_i18ngrep \"HEAD is now at 7329388\" messages &&\n-\ttest_line_count -gt 1 messages &&\n+\t(test_line_count -gt 1 messages || test -n \"$GETTEXT_POISON\") &&\n \tH=$(git rev-parse --verify HEAD) &&\n \tM=$(git show-ref -s --verify refs/heads/master) &&\n \ttest \"z$H\" = \"z$M\" &&\n-- \n2.7.3\n"},{"id":"288023","messageId":"1464799289-7639-4-git-send-email-vascomalmeida@sapo.pt","threadId":"42506","inReplyTo":"1464799289-7639-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v3 03/39] i18n: advice: internationalize message for conflicts","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-06-01T16:40:53Z","receivedAt":"2016-06-01T16:40:53Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Mark message for translation telling the user she has conflicts to\nresolve. Expose each particular use case, in order to enable translating\nentire sentences which would facilitate translating into other\nlanguages.\n\nChange \"Pull\" to lowercase to match other instances. Update test\nt5520-pull.sh, that relied on the old error message, to use the new one.\n\nAlthough we loose in source code conciseness, we would gain better\ntranslations because translators can 1) translate the entire sentence,\nincluding those terms concerning Git (committing, merging, etc) 2) have\nleeway to adapt to their languages.\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n advice.c        | 17 +++++++++++++++--\n builtin/pull.c  |  2 +-\n t/t5520-pull.sh |  2 +-\n 3 files changed, 17 insertions(+), 4 deletions(-)\n\ndiff --git a/advice.c b/advice.c\nindex cb445a7..b84ae49 100644\n--- a/advice.c\n+++ b/advice.c\n@@ -79,7 +79,20 @@ int git_default_advice_config(const char *var, const char *value)\n \n int error_resolve_conflict(const char *me)\n {\n-\terror(\"%s is not possible because you have unmerged files.\", me);\n+\tif (!strcmp(me, \"cherry-pick\"))\n+\t\terror(_(\"Cherry-picking is not possible because you have unmerged files.\"));\n+\telse if (!strcmp(me, \"commit\"))\n+\t\terror(_(\"Committing is not possible because you have unmerged files.\"));\n+\telse if (!strcmp(me, \"merge\"))\n+\t\terror(_(\"Merging is not possible because you have unmerged files.\"));\n+\telse if (!strcmp(me, \"pull\"))\n+\t\terror(_(\"Pulling is not possible because you have unmerged files.\"));\n+\telse if (!strcmp(me, \"revert\"))\n+\t\terror(_(\"Reverting is not possible because you have unmerged files.\"));\n+\telse\n+\t\terror(_(\"It is not possible to %s because you have unmerged files.\"),\n+\t\t\tme);\n+\n \tif (advice_resolve_conflict)\n \t\t/*\n \t\t * Message used both when 'git commit' fails and when\n@@ -93,7 +106,7 @@ int error_resolve_conflict(const char *me)\n void NORETURN die_resolve_conflict(const char *me)\n {\n \terror_resolve_conflict(me);\n-\tdie(\"Exiting because of an unresolved conflict.\");\n+\tdie(_(\"Exiting because of an unresolved conflict.\"));\n }\n \n void NORETURN die_conclude_merge(void)\ndiff --git a/builtin/pull.c b/builtin/pull.c\nindex 1d7333c..a980dcf 100644\n--- a/builtin/pull.c\n+++ b/builtin/pull.c\n@@ -852,7 +852,7 @@ int cmd_pull(int argc, const char **argv, const char *prefix)\n \tgit_config(git_pull_config, NULL);\n \n \tif (read_cache_unmerged())\n-\t\tdie_resolve_conflict(\"Pull\");\n+\t\tdie_resolve_conflict(\"pull\");\n \n \tif (file_exists(git_path(\"MERGE_HEAD\")))\n \t\tdie_conclude_merge();\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 739c089..45e44ca 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -211,7 +211,7 @@ test_expect_success 'fail if the index has unresolved entries' '\n \ttest -n \"$(git ls-files -u)\" &&\n \tcp file expected &&\n \ttest_must_fail git pull . second 2>err &&\n-\ttest_i18ngrep \"Pull is not possible because you have unmerged files\" err &&\n+\ttest_i18ngrep \"Pulling is not possible because you have unmerged files.\" err &&\n \ttest_cmp expected file &&\n \tgit add file &&\n \ttest -z \"$(git ls-files -u)\" &&\n-- \n2.7.3\n"},{"id":"288021","messageId":"1464799289-7639-5-git-send-email-vascomalmeida@sapo.pt","threadId":"42506","inReplyTo":"1464799289-7639-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v3 04/39] i18n: transport: mark strings for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-06-01T16:40:54Z","receivedAt":"2016-06-01T16:40:54Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Mark one printf string and one error string for translation.\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n transport.c | 20 ++++++++++----------\n 1 file changed, 10 insertions(+), 10 deletions(-)\n\ndiff --git a/transport.c b/transport.c\nindex 095e61f..59b911e 100644\n--- a/transport.c\n+++ b/transport.c\n@@ -59,7 +59,7 @@ static void set_upstreams(struct transport *transport, struct ref *refs,\n \t\t\t\tlocalname + 11, transport->remote->name,\n \t\t\t\tremotename);\n \t\telse\n-\t\t\tprintf(\"Would set upstream of '%s' to '%s' of '%s'\\n\",\n+\t\t\tprintf(_(\"Would set upstream of '%s' to '%s' of '%s'\\n\"),\n \t\t\t\tlocalname + 11, remotename + 11,\n \t\t\t\ttransport->remote->name);\n \t}\n@@ -148,7 +148,7 @@ static int set_git_option(struct git_transport_options *opts,\n \t\t\tchar *end;\n \t\t\topts->depth = strtol(value, &end, 0);\n \t\t\tif (*end)\n-\t\t\t\tdie(\"transport: invalid depth option '%s'\", value);\n+\t\t\t\tdie(_(\"transport: invalid depth option '%s'\"), value);\n \t\t}\n \t\treturn 0;\n \t}\n@@ -767,19 +767,19 @@ static void die_with_unpushed_submodules(struct string_list *needs_pushing)\n {\n \tint i;\n \n-\tfprintf(stderr, \"The following submodule paths contain changes that can\\n\"\n-\t\t\t\"not be found on any remote:\\n\");\n+\tfprintf(stderr, _(\"The following submodule paths contain changes that can\\n\"\n+\t\t\t\"not be found on any remote:\\n\"));\n \tfor (i = 0; i < needs_pushing->nr; i++)\n \t\tprintf(\"  %s\\n\", needs_pushing->items[i].string);\n-\tfprintf(stderr, \"\\nPlease try\\n\\n\"\n-\t\t\t\"\tgit push --recurse-submodules=on-demand\\n\\n\"\n-\t\t\t\"or cd to the path and use\\n\\n\"\n-\t\t\t\"\tgit push\\n\\n\"\n-\t\t\t\"to push them to a remote.\\n\\n\");\n+\tfprintf(stderr, _(\"\\nPlease try\\n\\n\"\n+\t\t\t  \"\tgit push --recurse-submodules=on-demand\\n\\n\"\n+\t\t\t  \"or cd to the path and use\\n\\n\"\n+\t\t\t  \"\tgit push\\n\\n\"\n+\t\t\t  \"to push them to a remote.\\n\\n\"));\n \n \tstring_list_clear(needs_pushing, 0);\n \n-\tdie(\"Aborting.\");\n+\tdie(_(\"Aborting.\"));\n }\n \n static int run_pre_push_hook(struct transport *transport,\n-- \n2.7.3\n"},{"id":"288024","messageId":"1464799289-7639-6-git-send-email-vascomalmeida@sapo.pt","threadId":"42506","inReplyTo":"1464799289-7639-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v3 05/39] i18n: sequencer: mark entire sentences for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-06-01T16:40:55Z","receivedAt":"2016-06-01T16:40:55Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Mark entire sentences of error message rather than assembling one using\nplaceholders (e.g. \"Cannot %s during a %s\").\n\nThat would facilitate translation work because it is easier to translate\na entire sentence than translating pieces. We would have better\ntranslations at the expense of source code verbosity.\n\nMoreover, translators can now 1) translate the terms \"revert\" and\n\"cherry-pick\" if they please 2) have more leeway to adapt their\ntranslations.\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n sequencer.c | 11 ++++++++---\n 1 file changed, 8 insertions(+), 3 deletions(-)\n\ndiff --git a/sequencer.c b/sequencer.c\nindex 4687ad4..88a7c78 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -697,9 +697,14 @@ static struct commit *parse_insn_line(char *bol, char *eol, struct replay_opts *\n \t * opts; we don't support arbitrary instructions\n \t */\n \tif (action != opts->action) {\n-\t\tconst char *action_str;\n-\t\taction_str = action == REPLAY_REVERT ? \"revert\" : \"cherry-pick\";\n-\t\terror(_(\"Cannot %s during a %s\"), action_str, action_name(opts));\n+\t\tif (action == REPLAY_REVERT)\n+\t\t      error((opts->action == REPLAY_REVERT)\n+\t\t\t    ? _(\"Cannot revert during a another revert.\")\n+\t\t\t    : _(\"Cannot revert during a cherry-pick.\"));\n+\t\telse\n+\t\t      error((opts->action == REPLAY_REVERT)\n+\t\t\t    ? _(\"Cannot cherry-pick during a revert.\")\n+\t\t\t    : _(\"Cannot cherry-pick during another cherry-pick.\"));\n \t\treturn NULL;\n \t}\n \n-- \n2.7.3\n"},{"id":"288026","messageId":"1464799289-7639-7-git-send-email-vascomalmeida@sapo.pt","threadId":"42506","inReplyTo":"1464799289-7639-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v3 06/39] i18n: sequencer: mark string for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-06-01T16:40:56Z","receivedAt":"2016-06-01T16:40:56Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Mark informative string \"<action_name>: fast-forward\" for translation.\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n sequencer.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/sequencer.c b/sequencer.c\nindex 88a7c78..57b3671 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -225,7 +225,7 @@ static int fast_forward_to(const unsigned char *to, const unsigned char *from,\n \tif (checkout_fast_forward(from, to, 1))\n \t\texit(128); /* the callee should have complained already */\n \n-\tstrbuf_addf(&sb, \"%s: fast-forward\", action_name(opts));\n+\tstrbuf_addf(&sb, _(\"%s: fast-forward\"), action_name(opts));\n \n \ttransaction = ref_transaction_begin(&err);\n \tif (!transaction ||\n-- \n2.7.3\n"},{"id":"288029","messageId":"1464799289-7639-8-git-send-email-vascomalmeida@sapo.pt","threadId":"42506","inReplyTo":"1464799289-7639-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v3 07/39] i18n: merge-octopus: mark messages for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-06-01T16:40:57Z","receivedAt":"2016-06-01T16:40:57Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Mark messages in git-merge-octopus.sh for translation.\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n git-merge-octopus.sh | 18 ++++++++++--------\n 1 file changed, 10 insertions(+), 8 deletions(-)\n\ndiff --git a/git-merge-octopus.sh b/git-merge-octopus.sh\nindex dc2fd1b..89e967a 100755\n--- a/git-merge-octopus.sh\n+++ b/git-merge-octopus.sh\n@@ -5,6 +5,8 @@\n # Resolve two or more trees.\n #\n \n+. git-sh-i18n\n+\n LF='\n '\n \n@@ -46,7 +48,7 @@ esac\n \n if ! git diff-index --quiet --cached HEAD --\n then\n-    echo \"Error: Your local changes to the following files would be overwritten by merge\"\n+    gettextln \"Error: Your local changes to the following files would be overwritten by merge\"\n     git diff-index --cached --name-only HEAD -- | sed -e 's/^/    /'\n     exit 2\n fi\n@@ -61,8 +63,8 @@ do\n \t\t# We allow only last one to have a hand-resolvable\n \t\t# conflicts.  Last round failed and we still had\n \t\t# a head to merge.\n-\t\techo \"Automated merge did not work.\"\n-\t\techo \"Should not be doing an Octopus.\"\n+\t\tgettextln \"Automated merge did not work.\"\n+\t\tgettextln \"Should not be doing an Octopus.\"\n \t\texit 2\n \tesac\n \n@@ -73,11 +75,11 @@ do\n \t\teval pretty_name=\\${GITHEAD_$SHA1_UP:-$pretty_name}\n \tfi\n \tcommon=$(git merge-base --all $SHA1 $MRC) ||\n-\t\tdie \"Unable to find common commit with $pretty_name\"\n+\t\tdie \"$(eval_gettext \"Unable to find common commit with \\$pretty_name\")\"\n \n \tcase \"$LF$common$LF\" in\n \t*\"$LF$SHA1$LF\"*)\n-\t\techo \"Already up-to-date with $pretty_name\"\n+\t\teval_gettextln \"Already up-to-date with \\$pretty_name\"\n \t\tcontinue\n \t\t;;\n \tesac\n@@ -89,7 +91,7 @@ do\n \t\t# tree as the intermediate result of the merge.\n \t\t# We still need to count this as part of the parent set.\n \n-\t\techo \"Fast-forwarding to: $pretty_name\"\n+\t\teval_gettextln \"Fast-forwarding to: \\$pretty_name\"\n \t\tgit read-tree -u -m $head $SHA1 || exit\n \t\tMRC=$SHA1 MRT=$(git write-tree)\n \t\tcontinue\n@@ -97,12 +99,12 @@ do\n \n \tNON_FF_MERGE=1\n \n-\techo \"Trying simple merge with $pretty_name\"\n+\teval_gettextln \"Trying simple merge with \\$pretty_name\"\n \tgit read-tree -u -m --aggressive  $common $MRT $SHA1 || exit 2\n \tnext=$(git write-tree 2>/dev/null)\n \tif test $? -ne 0\n \tthen\n-\t\techo \"Simple merge did not work, trying automatic merge.\"\n+\t\tgettextln \"Simple merge did not work, trying automatic merge.\"\n \t\tgit-merge-index -o git-merge-one-file -a ||\n \t\tOCTOPUS_FAILURE=1\n \t\tnext=$(git write-tree 2>/dev/null)\n-- \n2.7.3\n"},{"id":"288035","messageId":"1464799289-7639-9-git-send-email-vascomalmeida@sapo.pt","threadId":"42506","inReplyTo":"1464799289-7639-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v3 08/39] merge-octupus: use die shell function from git-sh-setup.sh","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-06-01T16:40:58Z","receivedAt":"2016-06-01T16:40:58Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Source git-sh-setup in order to use die shell function from\ngit-sh-setup.sh library instead of using the one defined in\ngit-merge-octopus.sh. Remove the former die function.\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n git-merge-octopus.sh | 6 +-----\n 1 file changed, 1 insertion(+), 5 deletions(-)\n\ndiff --git a/git-merge-octopus.sh b/git-merge-octopus.sh\nindex 89e967a..d79fc84 100755\n--- a/git-merge-octopus.sh\n+++ b/git-merge-octopus.sh\n@@ -5,16 +5,12 @@\n # Resolve two or more trees.\n #\n \n+. git-sh-setup\n . git-sh-i18n\n \n LF='\n '\n \n-die () {\n-    echo >&2 \"$*\"\n-    exit 1\n-}\n-\n # The first parameters up to -- are merge bases; the rest are heads.\n bases= head= remotes= sep_seen=\n for arg\n-- \n2.7.3\n"},{"id":"288025","messageId":"1464799289-7639-10-git-send-email-vascomalmeida@sapo.pt","threadId":"42506","inReplyTo":"1464799289-7639-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v3 09/39] i18n: rebase: fix marked string to use eval_gettext variant","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-06-01T16:40:59Z","receivedAt":"2016-06-01T16:40:59Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"The string message marked for translation should use eval_gettext\nvariant instead of the gettext one, since we want to dollar-substitute\n$head_name in the result.\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n git-rebase.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/git-rebase.sh b/git-rebase.sh\nindex 44ede36..1fadc04 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -154,7 +154,7 @@ move_to_original_branch () {\n \t\tgit symbolic-ref \\\n \t\t\t-m \"rebase finished: returning to $head_name\" \\\n \t\t\tHEAD $head_name ||\n-\t\tdie \"$(gettext \"Could not move back to $head_name\")\"\n+\t\tdie \"$(eval_gettext \"Could not move back to \\$head_name\")\"\n \t\t;;\n \tesac\n }\n-- \n2.7.3\n"},{"id":"288047","messageId":"1464799289-7639-11-git-send-email-vascomalmeida@sapo.pt","threadId":"42506","inReplyTo":"1464799289-7639-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v3 10/39] i18n: rebase: mark placeholder for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-06-01T16:41:00Z","receivedAt":"2016-06-01T16:41:00Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Mark placeholder \"<branch>\" in git-rebase.sh for translation. The string\ncontaining the named placeholder is passed to shell function\nerror_on_missing_default_upstream in git-parse-remote.sh which uses it\nto display a command hint for the user.\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n git-rebase.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/git-rebase.sh b/git-rebase.sh\nindex 1fadc04..9ba21ab 100755\n--- a/git-rebase.sh\n+++ b/git-rebase.sh\n@@ -449,7 +449,7 @@ then\n \t\tthen\n \t\t\t. git-parse-remote\n \t\t\terror_on_missing_default_upstream \"rebase\" \"rebase\" \\\n-\t\t\t\t\"against\" \"git rebase <branch>\"\n+\t\t\t\t\"against\" \"git rebase $(gettext '<branch>')\"\n \t\tfi\n \n \t\ttest \"$fork_point\" = auto && fork_point=t\n-- \n2.7.3\n"},{"id":"288053","messageId":"1464799289-7639-12-git-send-email-vascomalmeida@sapo.pt","threadId":"42506","inReplyTo":"1464799289-7639-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v3 11/39] i18n: bisect: simplify error message for i18n","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-06-01T16:41:01Z","receivedAt":"2016-06-01T16:41:01Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"The message was not being extracted by xgettext, although it was marked\nfor translation, seemingly because it contained a command substitution.\nMoreover, eval_gettext should be used instead of gettext for strings\nwith substitution.\n\nSee step 4. of section 15.5.2.1 Preparing Shell Scripts for\nInternationalization from gettext manual [1]:\n\"Simplify translatable strings so that they don't contain command\nsubstitution (\"`...`\" or \"$(...)\") [...]\"\n\n[1] http://www.gnu.org/software/gettext/manual/html_node/Preparing-Shell-Scripts.html\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n git-bisect.sh | 5 +++--\n 1 file changed, 3 insertions(+), 2 deletions(-)\n\ndiff --git a/git-bisect.sh b/git-bisect.sh\nindex 5d1cb00..737bf05 100755\n--- a/git-bisect.sh\n+++ b/git-bisect.sh\n@@ -277,8 +277,9 @@ bisect_state() {\n \t0,*)\n \t\tdie \"$(gettext \"Please call 'bisect_state' with at least one argument.\")\" ;;\n \t1,\"$TERM_BAD\"|1,\"$TERM_GOOD\"|1,skip)\n-\t\trev=$(git rev-parse --verify $(bisect_head)) ||\n-\t\t\tdie \"$(gettext \"Bad rev input: $(bisect_head)\")\"\n+\t\tbisected_head=$(bisect_head)\n+\t\trev=$(git rev-parse --verify \"$bisected_head\") ||\n+\t\t\tdie \"$(eval_gettext \"Bad rev input: \\$bisected_head\")\"\n \t\tbisect_write \"$state\" \"$rev\"\n \t\tcheck_expected_revs \"$rev\" ;;\n \t2,\"$TERM_BAD\"|*,\"$TERM_GOOD\"|*,skip)\n-- \n2.7.3\n"},{"id":"288031","messageId":"1464799289-7639-13-git-send-email-vascomalmeida@sapo.pt","threadId":"42506","inReplyTo":"1464799289-7639-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v3 12/39] t6030: update to use test_i18ncmp","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-06-01T16:41:02Z","receivedAt":"2016-06-01T16:41:02Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Since the git bisect output tested here is subject to translation, the\nhelper function test_i18ncmp should be used over test_cmp.\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n t/t6030-bisect-porcelain.sh | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh\nindex e74662b..7012011 100755\n--- a/t/t6030-bisect-porcelain.sh\n+++ b/t/t6030-bisect-porcelain.sh\n@@ -803,7 +803,7 @@ test_expect_success 'bisect terms needs 0 or 1 argument' '\n \ttest_must_fail git bisect terms 1 2 &&\n \ttest_must_fail git bisect terms 2>actual &&\n \techo \"no terms defined\" >expected &&\n-\ttest_cmp expected actual\n+\ttest_i18ncmp expected actual\n '\n \n test_expect_success 'bisect terms shows good/bad after start' '\n@@ -875,7 +875,7 @@ test_expect_success 'bisect start --term-* does store terms' '\n \tYour current terms are two for the old state\n \tand one for the new state.\n \tEOF\n-\ttest_cmp expected actual &&\n+\ttest_i18ncmp expected actual &&\n \tgit bisect terms --term-bad >actual &&\n \techo one >expected &&\n \ttest_cmp expected actual &&\n-- \n2.7.3\n"},{"id":"288030","messageId":"1464799289-7639-14-git-send-email-vascomalmeida@sapo.pt","threadId":"42506","inReplyTo":"1464799289-7639-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v3 13/39] i18n: git-sh-setup.sh: mark strings for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-06-01T16:41:03Z","receivedAt":"2016-06-01T16:41:03Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Positional arguments, such as $0, $1, etc, need to be stored on shell\nvariables for use in translatable strings, according to gettext manual\n[1].\n\nAdd git-sh-setup.sh to LOCALIZED_SH variable in Makefile to enable\nextraction of string marked for translation by xgettext.\n\nAlthough git-sh-setup.sh is a shell library to be sourced by other shell\nscripts, it is necessary to source git-sh-i18n at this point, because\nsome scripts don't do it themselves. Not sourcing git-sh-i18n would lead\nto failure due to, for instance, gettextln not being found.\n\nSource \"$(git --exec-path)\"/git-sh-i18n instead of simply git-sh-i18n,\nbecause latter case would fail test t2300-cd-to-toplevel.sh.\n\n[1] http://www.gnu.org/software/gettext/manual/html_node/Preparing-Shell-Scripts.html\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n Makefile        |  4 +++-\n git-sh-setup.sh | 62 +++++++++++++++++++++++++++++++++++++++++++--------------\n 2 files changed, 50 insertions(+), 16 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 0d59718..4e0c4eb 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -2062,7 +2062,9 @@ XGETTEXT_FLAGS_SH = $(XGETTEXT_FLAGS) --language=Shell \\\n \t--keyword=gettextln --keyword=eval_gettextln\n XGETTEXT_FLAGS_PERL = $(XGETTEXT_FLAGS) --keyword=__ --language=Perl\n LOCALIZED_C = $(C_OBJ:o=c) $(LIB_H) $(GENERATED_H)\n-LOCALIZED_SH = $(SCRIPT_SH) git-parse-remote.sh\n+LOCALIZED_SH = $(SCRIPT_SH)\n+LOCALIZED_SH += git-parse-remote.sh\n+LOCALIZED_SH += git-sh-setup.sh\n LOCALIZED_PERL = $(SCRIPT_PERL)\n \n ifdef XGETTEXT_INCLUDE_TESTS\ndiff --git a/git-sh-setup.sh b/git-sh-setup.sh\nindex c48139a..61a3d95 100644\n--- a/git-sh-setup.sh\n+++ b/git-sh-setup.sh\n@@ -2,6 +2,10 @@\n # to set up some variables pointing at the normal git directories and\n # a few helper shell functions.\n \n+# Some shell scripts source git-sh-setup (i.e. this scriplet) but\n+# don't source git-sh-i18n which is needed here for gettext support.\n+. \"$(git --exec-path)\"/git-sh-i18n\n+\n # Having this variable in your environment would break scripts because\n # you would cause \"cd\" to be taken to unexpected places.  If you\n # like CDPATH, define it for your interactive shell sessions without\n@@ -83,14 +87,14 @@ if test -n \"$OPTIONS_SPEC\"; then\n else\n \tdashless=$(basename -- \"$0\" | sed -e 's/-/ /')\n \tusage() {\n-\t\tdie \"usage: $dashless $USAGE\"\n+\t\tdie \"$(gettext usage:) $dashless $USAGE\"\n \t}\n \n \tif [ -z \"$LONG_USAGE\" ]\n \tthen\n-\t\tLONG_USAGE=\"usage: $dashless $USAGE\"\n+\t\tLONG_USAGE=\"$(gettext usage:) $dashless $USAGE\"\n \telse\n-\t\tLONG_USAGE=\"usage: $dashless $USAGE\n+\t\tLONG_USAGE=\"$(gettext usage:) $dashless $USAGE\n \n $LONG_USAGE\"\n \tfi\n@@ -182,7 +186,7 @@ is_bare_repository () {\n cd_to_toplevel () {\n \tcdup=$(git rev-parse --show-toplevel) &&\n \tcd \"$cdup\" || {\n-\t\techo >&2 \"Cannot chdir to $cdup, the toplevel of the working tree\"\n+\t\tgettextln \"Cannot chdir to \\$cdup, the toplevel of the working tree\" >&2\n \t\texit 1\n \t}\n }\n@@ -190,13 +194,16 @@ cd_to_toplevel () {\n require_work_tree_exists () {\n \tif test \"z$(git rev-parse --is-bare-repository)\" != zfalse\n \tthen\n-\t\tdie \"fatal: $0 cannot be used without a working tree.\"\n+\t\tprogram_name=$0\n+\t\tdie \"$(gettext \"fatal: \\$program_name cannot be used without a working tree.\")\"\n \tfi\n }\n \n require_work_tree () {\n-\ttest \"$(git rev-parse --is-inside-work-tree 2>/dev/null)\" = true ||\n-\tdie \"fatal: $0 cannot be used without a working tree.\"\n+\ttest \"$(git rev-parse --is-inside-work-tree 2>/dev/null)\" = true || {\n+\t\tprogram_name=$0\n+\t\tdie \"$(gettext \"fatal: \\$program_name cannot be used without a working tree.\")\"\n+\t}\n }\n \n require_clean_work_tree () {\n@@ -206,24 +213,49 @@ require_clean_work_tree () {\n \n \tif ! git diff-files --quiet --ignore-submodules\n \tthen\n-\t\techo >&2 \"Cannot $1: You have unstaged changes.\"\n+\t\taction=$1\n+\t\tcase \"$action\" in\n+\t\trebase)\n+\t\t\tgettextln \"Cannot rebase: You have unstaged changes.\" >&2\n+\t\t\t;;\n+\t\t\"rewrite branches\")\n+\t\t\tgettextln \"Cannot rewrite branches: You have unstaged changes.\" >&2\n+\t\t\t;;\n+\t\t\"pull with rebase\")\n+\t\t\tgettextln \"Cannot pull with rebase: You have unstaged changes.\" >&2\n+\t\t\t;;\n+\t\t*)\n+\t\t\teval_gettextln \"Cannot \\$action: You have unstaged changes.\" >&2\n+\t\t\t;;\n+\t\tesac\n \t\terr=1\n \tfi\n \n \tif ! git diff-index --cached --quiet --ignore-submodules HEAD --\n \tthen\n-\t\tif [ $err = 0 ]\n+\t\tif test $err = 0\n \t\tthen\n-\t\t    echo >&2 \"Cannot $1: Your index contains uncommitted changes.\"\n+\t\t\taction=$1\n+\t\t\tcase \"$action\" in\n+\t\t\trebase)\n+\t\t\t\tgettextln \"Cannot rebase: Your index contains uncommitted changes.\" >&2\n+\t\t\t\t;;\n+\t\t\t\"pull with rebase\")\n+\t\t\t\tgettextln \"Cannot pull with rebase: Your index contains uncommitted changes.\" >&2\n+\t\t\t\t;;\n+\t\t\t*)\n+\t\t\t\teval_gettextln \"Cannot \\$action: Your index contains uncommitted changes.\" >&2\n+\t\t\t\t;;\n+\t\t\tesac\n \t\telse\n-\t\t    echo >&2 \"Additionally, your index contains uncommitted changes.\"\n+\t\t    gettextln \"Additionally, your index contains uncommitted changes.\" >&2\n \t\tfi\n \t\terr=1\n \tfi\n \n-\tif [ $err = 1 ]\n+\tif test $err = 1\n \tthen\n-\t\ttest -n \"$2\" && echo >&2 \"$2\"\n+\t\ttest -n \"$2\" && echo \"$2\" >&2\n \t\texit 1\n \tfi\n }\n@@ -336,12 +368,12 @@ git_dir_init () {\n \tthen\n \t\ttest -z \"$(git rev-parse --show-cdup)\" || {\n \t\t\texit=$?\n-\t\t\techo >&2 \"You need to run this command from the toplevel of the working tree.\"\n+\t\t\tgettextln \"You need to run this command from the toplevel of the working tree.\" >&2\n \t\t\texit $exit\n \t\t}\n \tfi\n \ttest -n \"$GIT_DIR\" && GIT_DIR=$(cd \"$GIT_DIR\" && pwd) || {\n-\t\techo >&2 \"Unable to determine absolute path of git directory\"\n+\t\tgettextln \"Unable to determine absolute path of git directory\" >&2\n \t\texit 1\n \t}\n \t: ${GIT_OBJECT_DIRECTORY=\"$(git rev-parse --git-path objects)\"}\n-- \n2.7.3\n"},{"id":"288042","messageId":"1464799289-7639-15-git-send-email-vascomalmeida@sapo.pt","threadId":"42506","inReplyTo":"1464799289-7639-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v3 14/39] i18n: rebase-interactive: mark strings for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-06-01T16:41:04Z","receivedAt":"2016-06-01T16:41:04Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Mark strings in git-rebase--interactive.sh for translation. There is no\nneed to source git-sh-i18n since git-rebase.sh already does so.\n\nAdd git-rebase--interactive.sh to LOCALIZED_SH in Makefile in order to\nenable extracting strings marked for translation by xgettext.\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n Makefile                   |   1 +\n git-rebase--interactive.sh | 191 ++++++++++++++++++++++++---------------------\n 2 files changed, 102 insertions(+), 90 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 4e0c4eb..d8117bb 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -2064,6 +2064,7 @@ XGETTEXT_FLAGS_PERL = $(XGETTEXT_FLAGS) --keyword=__ --language=Perl\n LOCALIZED_C = $(C_OBJ:o=c) $(LIB_H) $(GENERATED_H)\n LOCALIZED_SH = $(SCRIPT_SH)\n LOCALIZED_SH += git-parse-remote.sh\n+LOCALIZED_SH += git-rebase--interactive.sh\n LOCALIZED_SH += git-sh-setup.sh\n LOCALIZED_PERL = $(SCRIPT_PERL)\n \ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex 9d2bfb7..078ca5b 100644\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -128,7 +128,7 @@ mark_action_done () {\n \tif test \"$last_count\" != \"$new_count\"\n \tthen\n \t\tlast_count=$new_count\n-\t\tprintf \"Rebasing (%d/%d)\\r\" $new_count $total\n+\t\teval_gettext \"Rebasing (\\$new_count/\\$total)\"; printf \"\\r\"\n \t\ttest -z \"$verbose\" || echo\n \tfi\n }\n@@ -201,13 +201,14 @@ exit_with_patch () {\n \tmake_patch $1\n \tgit rev-parse --verify HEAD > \"$amend\"\n \tgpg_sign_opt_quoted=${gpg_sign_opt:+$(git rev-parse --sq-quote \"$gpg_sign_opt\")}\n-\twarn \"You can amend the commit now, with\"\n-\twarn\n-\twarn \"\tgit commit --amend $gpg_sign_opt_quoted\"\n-\twarn\n-\twarn \"Once you are satisfied with your changes, run\"\n-\twarn\n-\twarn \"\tgit rebase --continue\"\n+\twarn \"$(eval_gettext \"\\\n+You can amend the commit now, with\n+\n+\tgit commit --amend \\$gpg_sign_opt_quoted\n+\n+Once you are satisfied with your changes, run\n+\n+\tgit rebase --continue\")\"\n \twarn\n \texit $2\n }\n@@ -222,10 +223,12 @@ has_action () {\n }\n \n is_empty_commit() {\n-\ttree=$(git rev-parse -q --verify \"$1\"^{tree} 2>/dev/null ||\n-\t\tdie \"$1: not a commit that can be picked\")\n-\tptree=$(git rev-parse -q --verify \"$1\"^^{tree} 2>/dev/null ||\n-\t\tptree=4b825dc642cb6eb9a060e54bf8d69288fbee4904)\n+\ttree=$(git rev-parse -q --verify \"$1\"^{tree} 2>/dev/null) || {\n+\t\tsha1=$1\n+\t\tdie \"$(eval_gettext \"\\$sha1: not a commit that can be picked\")\"\n+\t}\n+\tptree=$(git rev-parse -q --verify \"$1\"^^{tree} 2>/dev/null) ||\n+\t\tptree=4b825dc642cb6eb9a060e54bf8d69288fbee4904\n \ttest \"$tree\" = \"$ptree\"\n }\n \n@@ -261,7 +264,7 @@ pick_one () {\n \n \tcase \"$1\" in -n) sha1=$2; ff= ;; *) sha1=$1 ;; esac\n \tcase \"$force_rebase\" in '') ;; ?*) ff= ;; esac\n-\toutput git rev-parse --verify $sha1 || die \"Invalid commit name: $sha1\"\n+\toutput git rev-parse --verify $sha1 || die \"$(eval_gettext \"Invalid commit name: \\$sha1\")\"\n \n \tif is_empty_commit \"$sha1\"\n \tthen\n@@ -303,7 +306,7 @@ pick_one_preserving_merges () {\n \t\t\t\tgit rev-parse HEAD > \"$rewritten\"/$current_commit\n \t\t\tdone <\"$state_dir\"/current-commit\n \t\t\trm \"$state_dir\"/current-commit ||\n-\t\t\tdie \"Cannot write current commit's replacement sha1\"\n+\t\t\t\tdie \"$(gettext \"Cannot write current commit's replacement sha1\")\"\n \t\tfi\n \tfi\n \n@@ -355,9 +358,9 @@ pick_one_preserving_merges () {\n \tdone\n \tcase $fast_forward in\n \tt)\n-\t\toutput warn \"Fast-forward to $sha1\"\n+\t\toutput warn \"$(eval_gettext \"Fast-forward to \\$sha1\")\"\n \t\toutput git reset --hard $sha1 ||\n-\t\t\tdie \"Cannot fast-forward to $sha1\"\n+\t\t\tdie \"$(eval_gettext \"Cannot fast-forward to \\$sha1\")\"\n \t\t;;\n \tf)\n \t\tfirst_parent=$(expr \"$new_parents\" : ' \\([^ ]*\\)')\n@@ -366,12 +369,12 @@ pick_one_preserving_merges () {\n \t\tthen\n \t\t\t# detach HEAD to current parent\n \t\t\toutput git checkout $first_parent 2> /dev/null ||\n-\t\t\t\tdie \"Cannot move HEAD to $first_parent\"\n+\t\t\t\tdie \"$(eval_gettext \"Cannot move HEAD to \\$first_parent\")\"\n \t\tfi\n \n \t\tcase \"$new_parents\" in\n \t\t' '*' '*)\n-\t\t\ttest \"a$1\" = a-n && die \"Refusing to squash a merge: $sha1\"\n+\t\t\ttest \"a$1\" = a-n && die \"$(eval_gettext \"Refusing to squash a merge: \\$sha1\")\"\n \n \t\t\t# redo merge\n \t\t\tauthor_script_content=$(get_author_ident_from_commit $sha1)\n@@ -385,7 +388,7 @@ pick_one_preserving_merges () {\n \t\t\t\t$merge_args $strategy_args -m \"$msg_content\" $new_parents'\n \t\t\tthen\n \t\t\t\tprintf \"%s\\n\" \"$msg_content\" > \"$GIT_DIR\"/MERGE_MSG\n-\t\t\t\tdie_with_patch $sha1 \"Error redoing merge $sha1\"\n+\t\t\t\tdie_with_patch $sha1 \"$(eval_gettext \"Error redoing merge \\$sha1\")\"\n \t\t\tfi\n \t\t\techo \"$sha1 $(git rev-parse HEAD^0)\" >> \"$rewritten_list\"\n \t\t\t;;\n@@ -393,7 +396,7 @@ pick_one_preserving_merges () {\n \t\t\toutput eval git cherry-pick \\\n \t\t\t\t${gpg_sign_opt:+$(git rev-parse --sq-quote \"$gpg_sign_opt\")} \\\n \t\t\t\t\"$strategy_args\" \"$@\" ||\n-\t\t\t\tdie_with_patch $sha1 \"Could not pick $sha1\"\n+\t\t\t\tdie_with_patch $sha1 \"$(eval_gettext \"Could not pick \\$sha1\")\"\n \t\t\t;;\n \t\tesac\n \t\t;;\n@@ -460,12 +463,14 @@ peek_next_command () {\n # messages, effectively causing the combined commit to be used as the\n # new basis for any further squash/fixups.  Args: sha1 rest\n die_failed_squash() {\n+\tsha1=$1\n+\trest=$2\n \tmv \"$squash_msg\" \"$msg\" || exit\n \trm -f \"$fixup_msg\"\n \tcp \"$msg\" \"$GIT_DIR\"/MERGE_MSG || exit\n \twarn\n-\twarn \"Could not apply $1... $2\"\n-\tdie_with_patch $1 \"\"\n+\twarn \"$(eval_gettext \"Could not apply \\$sha1... \\$rest\")\"\n+\tdie_with_patch $sha1 \"\"\n }\n \n flush_rewritten_pending() {\n@@ -489,6 +494,8 @@ record_in_rewritten() {\n }\n \n do_pick () {\n+\tsha1=$1\n+\trest=$2\n \tif test \"$(git rev-parse HEAD)\" = \"$squash_onto\"\n \tthen\n \t\t# Set the correct commit message and author info on the\n@@ -500,15 +507,15 @@ do_pick () {\n \t\t# resolve before manually running git commit --amend then git\n \t\t# rebase --continue.\n \t\tgit commit --allow-empty --allow-empty-message --amend \\\n-\t\t\t   --no-post-rewrite -n -q -C $1 &&\n-\t\t\tpick_one -n $1 &&\n+\t\t\t   --no-post-rewrite -n -q -C $sha1 &&\n+\t\t\tpick_one -n $sha1 &&\n \t\t\tgit commit --allow-empty --allow-empty-message \\\n-\t\t\t\t   --amend --no-post-rewrite -n -q -C $1 \\\n+\t\t\t\t   --amend --no-post-rewrite -n -q -C $sha1 \\\n \t\t\t\t   ${gpg_sign_opt:+\"$gpg_sign_opt\"} ||\n-\t\t\tdie_with_patch $1 \"Could not apply $1... $2\"\n+\t\t\t\t   die_with_patch $sha1 \"$(eval_gettext \"Could not apply \\$sha1... \\$rest\")\"\n \telse\n-\t\tpick_one $1 ||\n-\t\t\tdie_with_patch $1 \"Could not apply $1... $2\"\n+\t\tpick_one $sha1 ||\n+\t\t\tdie_with_patch $sha1 \"$(eval_gettext \"Could not apply \\$sha1... \\$rest\")\"\n \tfi\n }\n \n@@ -536,10 +543,11 @@ do_next () {\n \t\tmark_action_done\n \t\tdo_pick $sha1 \"$rest\"\n \t\tgit commit --amend --no-post-rewrite ${gpg_sign_opt:+\"$gpg_sign_opt\"} || {\n-\t\t\twarn \"Could not amend commit after successfully picking $sha1... $rest\"\n-\t\t\twarn \"This is most likely due to an empty commit message, or the pre-commit hook\"\n-\t\t\twarn \"failed. If the pre-commit hook failed, you may need to resolve the issue before\"\n-\t\t\twarn \"you are able to reword the commit.\"\n+\t\t\twarn \"$(eval_gettext \"\\\n+Could not amend commit after successfully picking \\$sha1... \\$rest\n+This is most likely due to an empty commit message, or the pre-commit hook\n+failed. If the pre-commit hook failed, you may need to resolve the issue before\n+you are able to reword the commit.\")\"\n \t\t\texit_with_patch $sha1 1\n \t\t}\n \t\trecord_in_rewritten $sha1\n@@ -550,7 +558,7 @@ do_next () {\n \t\tmark_action_done\n \t\tdo_pick $sha1 \"$rest\"\n \t\tsha1_abbrev=$(git rev-parse --short $sha1)\n-\t\twarn \"Stopped at $sha1_abbrev... $rest\"\n+\t\twarn \"$(eval_gettext \"Stopped at \\$sha1_abbrev... \\$rest\")\"\n \t\texit_with_patch $sha1 0\n \t\t;;\n \tsquash|s|fixup|f)\n@@ -565,7 +573,7 @@ do_next () {\n \t\tcomment_for_reflog $squash_style\n \n \t\ttest -f \"$done\" && has_action \"$done\" ||\n-\t\t\tdie \"Cannot '$squash_style' without a previous commit\"\n+\t\t\tdie \"$(eval_gettext \"Cannot '\\$squash_style' without a previous commit\")\"\n \n \t\tmark_action_done\n \t\tupdate_squash_messages $squash_style $sha1\n@@ -607,7 +615,7 @@ do_next () {\n \tx|\"exec\")\n \t\tread -r command rest < \"$todo\"\n \t\tmark_action_done\n-\t\tprintf 'Executing: %s\\n' \"$rest\"\n+\t\teval_gettextln \"Executing: \\$rest\"\n \t\t\"${SHELL:-@SHELL_PATH@}\" -c \"$rest\" # Actual execution\n \t\tstatus=$?\n \t\t# Run in subshell because require_clean_work_tree can die.\n@@ -615,13 +623,14 @@ do_next () {\n \t\t(require_clean_work_tree \"rebase\" 2>/dev/null) || dirty=t\n \t\tif test \"$status\" -ne 0\n \t\tthen\n-\t\t\twarn \"Execution failed: $rest\"\n+\t\t\twarn \"$(eval_gettext \"Execution failed: \\$rest\")\"\n \t\t\ttest \"$dirty\" = f ||\n-\t\t\twarn \"and made changes to the index and/or the working tree\"\n+\t\t\t\twarn \"$(gettext \"and made changes to the index and/or the working tree\")\"\n \n-\t\t\twarn \"You can fix the problem, and then run\"\n-\t\t\twarn\n-\t\t\twarn \"\tgit rebase --continue\"\n+\t\t\twarn \"$(gettext \"\\\n+You can fix the problem, and then run\n+\n+\tgit rebase --continue\")\"\n \t\t\twarn\n \t\t\tif test $status -eq 127\t\t# command not found\n \t\t\tthen\n@@ -630,18 +639,20 @@ do_next () {\n \t\t\texit \"$status\"\n \t\telif test \"$dirty\" = t\n \t\tthen\n-\t\t\twarn \"Execution succeeded: $rest\"\n-\t\t\twarn \"but left changes to the index and/or the working tree\"\n-\t\t\twarn \"Commit or stash your changes, and then run\"\n-\t\t\twarn\n-\t\t\twarn \"\tgit rebase --continue\"\n+\t\t\t# TRANSLATORS: after these lines is a command to be issued by the user\n+\t\t\twarn \"$(eval_gettext \"\\\n+Execution succeeded: \\$rest\n+but left changes to the index and/or the working tree\n+Commit or stash your changes, and then run\n+\n+\tgit rebase --continue\")\"\n \t\t\twarn\n \t\t\texit 1\n \t\tfi\n \t\t;;\n \t*)\n-\t\twarn \"Unknown command: $command $sha1 $rest\"\n-\t\tfixtodo=\"Please fix this using 'git rebase --edit-todo'.\"\n+\t\twarn \"$(eval_gettext \"Unknown command: \\$command \\$sha1 \\$rest\")\"\n+\t\tfixtodo=\"$(gettext \"Please fix this using 'git rebase --edit-todo'.\")\"\n \t\tif git rev-parse --verify -q \"$sha1\" >/dev/null\n \t\tthen\n \t\t\tdie_with_patch $sha1 \"$fixtodo\"\n@@ -676,7 +687,7 @@ do_next () {\n \t\t\"$hook\" rebase < \"$rewritten_list\"\n \t\ttrue # we don't care if this hook failed\n \tfi &&\n-\twarn \"Successfully rebased and updated $head_name.\"\n+\t\twarn \"$(eval_gettext \"Successfully rebased and updated \\$head_name.\")\"\n \n \treturn 1 # not failure; just to break the do_rest loop\n }\n@@ -723,7 +734,7 @@ skip_unnecessary_picks () {\n \t\trecord_in_rewritten \"$onto\"\n \t\t;;\n \tesac ||\n-\tdie \"Could not skip unnecessary pick commands\"\n+\t\tdie \"$(gettext \"Could not skip unnecessary pick commands\")\"\n }\n \n transform_todo_ids () {\n@@ -881,9 +892,9 @@ check_commit_sha () {\n \tif test $badsha -ne 0\n \tthen\n \t\tline=\"$(sed -n -e \"${2}p\" \"$3\")\"\n-\t\twarn \"Warning: the SHA-1 is missing or isn't\" \\\n-\t\t\t\"a commit in the following line:\"\n-\t\twarn \" - $line\"\n+\t\twarn \"$(eval_gettext \"\\\n+Warning: the SHA-1 is missing or isn't a commit in the following line:\n+ - \\$line\")\"\n \t\twarn\n \tfi\n \n@@ -914,9 +925,9 @@ check_bad_cmd_and_sha () {\n \t\t\t;;\n \t\t*)\n \t\t\tline=\"$(sed -n -e \"${lineno}p\" \"$1\")\"\n-\t\t\twarn \"Warning: the command isn't recognized\" \\\n-\t\t\t\t\"in the following line:\"\n-\t\t\twarn \" - $line\"\n+\t\t\twarn \"$(eval_gettext \"\\\n+Warning: the command isn't recognized in the following line:\n+ - \\$line\")\"\n \t\t\twarn\n \t\t\tretval=1\n \t\t\t;;\n@@ -953,7 +964,7 @@ warn_lines () {\n # Switch to the branch in $into and notify it in the reflog\n checkout_onto () {\n \tGIT_REFLOG_ACTION=\"$GIT_REFLOG_ACTION: checkout $onto_name\"\n-\toutput git checkout $onto || die_abort \"could not detach HEAD\"\n+\toutput git checkout $onto || die_abort \"$(gettext \"could not detach HEAD\")\"\n \tgit update-ref ORIG_HEAD $orig_head\n }\n \n@@ -991,28 +1002,26 @@ check_todo_list () {\n \t\tthen\n \t\t\ttest \"$check_level\" = error && raise_error=t\n \n-\t\t\twarn \"Warning: some commits may have been dropped\" \\\n-\t\t\t\t\"accidentally.\"\n-\t\t\twarn \"Dropped commits (newer to older):\"\n+\t\t\twarn \"$(gettext \"\\\n+Warning: some commits may have been dropped accidentally.\n+Dropped commits (newer to older):\")\"\n \n \t\t\t# Make the list user-friendly and display\n \t\t\topt=\"--no-walk=sorted --format=oneline --abbrev-commit --stdin\"\n \t\t\tgit rev-list $opt <\"$todo\".miss | warn_lines\n \n-\t\t\twarn \"To avoid this message, use \\\"drop\\\" to\" \\\n-\t\t\t\t\"explicitly remove a commit.\"\n-\t\t\twarn\n-\t\t\twarn \"Use 'git config rebase.missingCommitsCheck' to change\" \\\n-\t\t\t\t\"the level of warnings.\"\n-\t\t\twarn \"The possible behaviours are: ignore, warn, error.\"\n+\t\t\twarn \"$(gettext \"\\\n+To avoid this message, use \\\"drop\\\" to explicitly remove a commit.\n+\n+Use 'git config rebase.missingCommitsCheck' to change the level of warnings.\n+The possible behaviours are: ignore, warn, error.\")\"\n \t\t\twarn\n \t\tfi\n \t\t;;\n \tignore)\n \t\t;;\n \t*)\n-\t\twarn \"Unrecognized setting $check_level for option\" \\\n-\t\t\t\"rebase.missingCommitsCheck. Ignoring.\"\n+\t\twarn \"$(eval_gettext \"Unrecognized setting \\$check_level for option rebase.missingCommitsCheck. Ignoring.\")\"\n \t\t;;\n \tesac\n \n@@ -1029,8 +1038,8 @@ check_todo_list () {\n \t\t# placed before the commit of the next action\n \t\tcheckout_onto\n \n-\t\twarn \"You can fix this with 'git rebase --edit-todo'.\"\n-\t\tdie \"Or you can abort the rebase with 'git rebase --abort'.\"\n+\t\twarn \"$(gettext \"You can fix this with 'git rebase --edit-todo'.\")\"\n+\t\tdie \"$(gettext \"Or you can abort the rebase with 'git rebase --abort'.\")\"\n \tfi\n }\n \n@@ -1054,41 +1063,43 @@ continue)\n \n \t\ttest ! -f \"$GIT_DIR\"/CHERRY_PICK_HEAD ||\n \t\trm \"$GIT_DIR\"/CHERRY_PICK_HEAD ||\n-\t\tdie \"Could not remove CHERRY_PICK_HEAD\"\n+\t\tdie \"$(gettext \"Could not remove CHERRY_PICK_HEAD\")\"\n \telse\n \t\tif ! test -f \"$author_script\"\n \t\tthen\n \t\t\tgpg_sign_opt_quoted=${gpg_sign_opt:+$(git rev-parse --sq-quote \"$gpg_sign_opt\")}\n-\t\t\tdie \"You have staged changes in your working tree. If these changes are meant to be\n+\t\t\tdie \"$(eval_gettext \"\\\n+You have staged changes in your working tree.\n+If these changes are meant to be\n squashed into the previous commit, run:\n \n-  git commit --amend $gpg_sign_opt_quoted\n+  git commit --amend \\$gpg_sign_opt_quoted\n \n If they are meant to go into a new commit, run:\n \n-  git commit $gpg_sign_opt_quoted\n+  git commit \\$gpg_sign_opt_quoted\n \n In both case, once you're done, continue with:\n \n   git rebase --continue\n-\"\n+\")\"\n \t\tfi\n \t\t. \"$author_script\" ||\n-\t\t\tdie \"Error trying to find the author identity to amend commit\"\n+\t\t\tdie \"$(gettext \"Error trying to find the author identity to amend commit\")\"\n \t\tif test -f \"$amend\"\n \t\tthen\n \t\t\tcurrent_head=$(git rev-parse --verify HEAD)\n \t\t\ttest \"$current_head\" = $(cat \"$amend\") ||\n-\t\t\tdie \"\\\n-You have uncommitted changes in your working tree. Please, commit them\n-first and then run 'git rebase --continue' again.\"\n+\t\t\tdie \"$(gettext \"\\\n+You have uncommitted changes in your working tree. Please commit them\n+first and then run 'git rebase --continue' again.\")\"\n \t\t\tdo_with_author git commit --amend --no-verify -F \"$msg\" -e \\\n \t\t\t\t${gpg_sign_opt:+\"$gpg_sign_opt\"} ||\n-\t\t\t\tdie \"Could not commit staged changes.\"\n+\t\t\t\tdie \"$(gettext \"Could not commit staged changes.\")\"\n \t\telse\n \t\t\tdo_with_author git commit --no-verify -F \"$msg\" -e \\\n \t\t\t\t${gpg_sign_opt:+\"$gpg_sign_opt\"} ||\n-\t\t\t\tdie \"Could not commit staged changes.\"\n+\t\t\t\tdie \"$(gettext \"Could not commit staged changes.\")\"\n \t\tfi\n \tfi\n \n@@ -1121,7 +1132,7 @@ To continue rebase after editing, run:\n EOF\n \n \tgit_sequence_editor \"$todo\" ||\n-\t\tdie \"Could not execute editor\"\n+\t\tdie \"$(gettext \"Could not execute editor\")\"\n \texpand_todo_ids\n \n \texit\n@@ -1129,7 +1140,7 @@ EOF\n esac\n \n git var GIT_COMMITTER_IDENT >/dev/null ||\n-\tdie \"You need to set your committer info first\"\n+\tdie \"$(gettext \"You need to set your committer info first\")\"\n \n comment_for_reflog start\n \n@@ -1137,15 +1148,15 @@ if test ! -z \"$switch_to\"\n then\n \tGIT_REFLOG_ACTION=\"$GIT_REFLOG_ACTION: checkout $switch_to\"\n \toutput git checkout \"$switch_to\" -- ||\n-\tdie \"Could not checkout $switch_to\"\n+\t\tdie \"$(eval_gettext \"Could not checkout \\$switch_to\")\"\n \n \tcomment_for_reflog start\n fi\n \n-orig_head=$(git rev-parse --verify HEAD) || die \"No HEAD?\"\n-mkdir -p \"$state_dir\" || die \"Could not create temporary $state_dir\"\n+orig_head=$(git rev-parse --verify HEAD) || die \"$(gettext \"No HEAD?\")\"\n+mkdir -p \"$state_dir\" || die \"$(eval_gettext \"Could not create temporary \\$state_dir\")\"\n \n-: > \"$state_dir\"/interactive || die \"Could not mark as interactive\"\n+: > \"$state_dir\"/interactive || die \"$(gettext \"Could not mark as interactive\")\"\n write_basic_state\n if test t = \"$preserve_merges\"\n then\n@@ -1155,12 +1166,12 @@ then\n \t\tfor c in $(git merge-base --all $orig_head $upstream)\n \t\tdo\n \t\t\techo $onto > \"$rewritten\"/$c ||\n-\t\t\t\tdie \"Could not init rewritten commits\"\n+\t\t\t\tdie \"$(gettext \"Could not init rewritten commits\")\"\n \t\tdone\n \telse\n \t\tmkdir \"$rewritten\" &&\n \t\techo $onto > \"$rewritten\"/root ||\n-\t\t\tdie \"Could not init rewritten commits\"\n+\t\t\tdie \"$(gettext \"Could not init rewritten commits\")\"\n \tfi\n \t# No cherry-pick because our first pass is to determine\n \t# parents to rewrite and skipping dropped commits would\n@@ -1270,7 +1281,7 @@ EOF\n \n if test -z \"$keep_empty\"\n then\n-\tprintf '%s\\n' \"$comment_char Note that empty commits are commented out\" >>\"$todo\"\n+\tprintf '%s\\n' \"$comment_char $(gettext \"Note that empty commits are commented out\")\" >>\"$todo\"\n fi\n \n \n@@ -1280,7 +1291,7 @@ has_action \"$todo\" ||\n cp \"$todo\" \"$todo\".backup\n collapse_todo_ids\n git_sequence_editor \"$todo\" ||\n-\tdie_abort \"Could not execute editor\"\n+\tdie_abort \"$(gettext \"Could not execute editor\")\"\n \n has_action \"$todo\" ||\n \treturn 2\n-- \n2.7.3\n"},{"id":"288032","messageId":"1464799289-7639-16-git-send-email-vascomalmeida@sapo.pt","threadId":"42506","inReplyTo":"1464799289-7639-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v3 15/39] i18n: rebase-interactive: mark here-doc strings for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-06-01T16:41:05Z","receivedAt":"2016-06-01T16:41:05Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Use pipe to send gettext output to git stripspace instead of the\noriginal method of using shell here-document, because command\nsubstitution '$(...)' would not take place inside the here-documents.\nThe exception is the case of the last here-document redirecting to cat,\nin which commands substitution works and, thus, is preserved in this\ncommit.\n\nt3404: adapt test to the strings newly marked for translation\nTest t3404-rebase-interactive.sh would fail under GETTEXT_POISON unless\nusing test_i18ngrep.\n\nAdd eval_ngettext fallback functions to be called when running, for\ninstance, under GETTEXT_POISON. Otherwise, tests would fail under\nGETTEXT_POISON, or other build that doesn't support the GNU gettext,\nbecause that function could not be found.\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n git-rebase--interactive.sh    | 30 +++++++++++++++---------------\n git-sh-i18n.sh                | 18 ++++++++++++++++++\n t/t3404-rebase-interactive.sh | 14 +++++++-------\n 3 files changed, 40 insertions(+), 22 deletions(-)\n\ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex 078ca5b..e132f07 100644\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -144,29 +144,28 @@ reschedule_last_action () {\n }\n \n append_todo_help () {\n-\tgit stripspace --comment-lines >>\"$todo\" <<\\EOF\n-\n+\tgettext \"\n Commands:\n  p, pick = use commit\n  r, reword = use commit, but edit the commit message\n  e, edit = use commit, but stop for amending\n  s, squash = use commit, but meld into previous commit\n- f, fixup = like \"squash\", but discard this commit's log message\n+ f, fixup = like \\\"squash\\\", but discard this commit's log message\n  x, exec = run command (the rest of the line) using shell\n  d, drop = remove commit\n \n These lines can be re-ordered; they are executed from top to bottom.\n+\" | git stripspace --comment-lines >>\"$todo\"\n \n-EOF\n \tif test $(get_missing_commit_check_level) = error\n \tthen\n-\t\tgit stripspace --comment-lines >>\"$todo\" <<\\EOF\n+\t\tgettext \"\n Do not remove any line. Use 'drop' explicitly to remove a commit.\n-EOF\n+\" | git stripspace --comment-lines >>\"$todo\"\n \telse\n-\t\tgit stripspace --comment-lines >>\"$todo\" <<\\EOF\n+\t\tgettext \"\n If you remove a line here THAT COMMIT WILL BE LOST.\n-EOF\n+\" | git stripspace --comment-lines >>\"$todo\"\n \tfi\n }\n \n@@ -1123,13 +1122,12 @@ edit-todo)\n \tmv -f \"$todo\".new \"$todo\"\n \tcollapse_todo_ids\n \tappend_todo_help\n-\tgit stripspace --comment-lines >>\"$todo\" <<\\EOF\n-\n+\tgettext \"\n You are editing the todo file of an ongoing interactive rebase.\n To continue rebase after editing, run:\n     git rebase --continue\n \n-EOF\n+\" | git stripspace --comment-lines >>\"$todo\"\n \n \tgit_sequence_editor \"$todo\" ||\n \t\tdie \"$(gettext \"Could not execute editor\")\"\n@@ -1270,14 +1268,16 @@ todocount=${todocount##* }\n \n cat >>\"$todo\" <<EOF\n \n-$comment_char Rebase $shortrevisions onto $shortonto ($todocount command(s))\n+$comment_char $(eval_ngettext \\\n+\t\"Rebase \\$shortrevisions onto \\$shortonto (\\$todocount command)\" \\\n+\t\"Rebase \\$shortrevisions onto \\$shortonto (\\$todocount commands)\" \\\n+\t\"$todocount\")\n EOF\n append_todo_help\n-git stripspace --comment-lines >>\"$todo\" <<\\EOF\n-\n+gettext \"\n However, if you remove everything, the rebase will be aborted.\n \n-EOF\n+\" | git stripspace --comment-lines >>\"$todo\"\n \n if test -z \"$keep_empty\"\n then\ndiff --git a/git-sh-i18n.sh b/git-sh-i18n.sh\nindex e6c3116..1ef1889 100644\n--- a/git-sh-i18n.sh\n+++ b/git-sh-i18n.sh\n@@ -53,6 +53,13 @@ gettext_without_eval_gettext)\n \t\t\tgit sh-i18n--envsubst \"$1\"\n \t\t)\n \t}\n+\n+\teval_ngettext () {\n+\t\tngettext \"$1\" \"$2\" \"$3\" | (\n+\t\t\texport PATH $(git sh-i18n--envsubst --variables \"$2\");\n+\t\t\tgit sh-i18n--envsubst \"$2\"\n+\t\t)\n+\t}\n \t;;\n poison)\n \t# Emit garbage so that tests that incorrectly rely on translatable\n@@ -64,6 +71,10 @@ poison)\n \teval_gettext () {\n \t\tprintf \"%s\" \"# GETTEXT POISON #\"\n \t}\n+\n+\teval_ngettext () {\n+\t\tprintf \"%s\" \"# GETTEXT POISON #\"\n+\t}\n \t;;\n *)\n \tgettext () {\n@@ -76,6 +87,13 @@ poison)\n \t\t\tgit sh-i18n--envsubst \"$1\"\n \t\t)\n \t}\n+\n+\teval_ngettext () {\n+\t\t(test \"$3\" = 1 && printf \"%s\" \"$1\" || printf \"%s\" \"$2\") | (\n+\t\t\texport PATH $(git sh-i18n--envsubst --variables \"$2\");\n+\t\t\tgit sh-i18n--envsubst \"$2\"\n+\t\t)\n+\t}\n \t;;\n esac\n \ndiff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh\nindex 66348f1..f4ccd10 100755\n--- a/t/t3404-rebase-interactive.sh\n+++ b/t/t3404-rebase-interactive.sh\n@@ -540,7 +540,7 @@ test_expect_success 'clean error after failed \"exec\"' '\n \techo \"edited again\" > file7 &&\n \tgit add file7 &&\n \ttest_must_fail git rebase --continue 2>error &&\n-\tgrep \"You have staged changes in your working tree.\" error\n+\ttest_i18ngrep \"You have staged changes in your working tree.\" error\n '\n \n test_expect_success 'rebase a detached HEAD' '\n@@ -1060,7 +1060,7 @@ test_expect_success 'todo count' '\n \tEOF\n \ttest_set_editor \"$(pwd)/dump-raw.sh\" &&\n \tgit rebase -i HEAD~4 >actual &&\n-\tgrep \"^# Rebase ..* onto ..* ([0-9]\" actual\n+\ttest_i18ngrep \"^# Rebase ..* onto ..* ([0-9]\" actual\n '\n \n test_expect_success 'rebase -i commits that overwrite untracked files (pick)' '\n@@ -1160,7 +1160,7 @@ test_expect_success 'rebase -i respects rebase.missingCommitsCheck = ignore' '\n \tFAKE_LINES=\"1 2 3 4\" \\\n \t\tgit rebase -i --root 2>actual &&\n \ttest D = $(git cat-file commit HEAD | sed -ne \\$p) &&\n-\ttest_cmp expect actual\n+\ttest_i18ncmp expect actual\n '\n \n cat >expect <<EOF\n@@ -1181,7 +1181,7 @@ test_expect_success 'rebase -i respects rebase.missingCommitsCheck = warn' '\n \tset_fake_editor &&\n \tFAKE_LINES=\"1 2 3 4\" \\\n \t\tgit rebase -i --root 2>actual &&\n-\ttest_cmp expect actual &&\n+\ttest_i18ncmp expect actual &&\n \ttest D = $(git cat-file commit HEAD | sed -ne \\$p)\n '\n \n@@ -1205,7 +1205,7 @@ test_expect_success 'rebase -i respects rebase.missingCommitsCheck = error' '\n \tset_fake_editor &&\n \ttest_must_fail env FAKE_LINES=\"1 2 4\" \\\n \t\tgit rebase -i --root 2>actual &&\n-\ttest_cmp expect actual &&\n+\ttest_i18ncmp expect actual &&\n \tcp .git/rebase-merge/git-rebase-todo.backup \\\n \t\t.git/rebase-merge/git-rebase-todo &&\n \tFAKE_LINES=\"1 2 drop 3 4 drop 5\" \\\n@@ -1228,7 +1228,7 @@ test_expect_success 'static check of bad command' '\n \tset_fake_editor &&\n \ttest_must_fail env FAKE_LINES=\"1 2 3 bad 4 5\" \\\n \t\tgit rebase -i --root 2>actual &&\n-\ttest_cmp expect actual &&\n+\ttest_i18ncmp expect actual &&\n \tFAKE_LINES=\"1 2 3 drop 4 5\" git rebase --edit-todo &&\n \tgit rebase --continue &&\n \ttest E = $(git cat-file commit HEAD | sed -ne \\$p) &&\n@@ -1263,7 +1263,7 @@ test_expect_success 'static check of bad SHA-1' '\n \tset_fake_editor &&\n \ttest_must_fail env FAKE_LINES=\"1 2 edit fakesha 3 4 5 #\" \\\n \t\tgit rebase -i --root 2>actual &&\n-\ttest_cmp expect actual &&\n+\ttest_i18ncmp expect actual &&\n \tFAKE_LINES=\"1 2 4 5 6\" git rebase --edit-todo &&\n \tgit rebase --continue &&\n \ttest E = $(git cat-file commit HEAD | sed -ne \\$p)\n-- \n2.7.3\n"},{"id":"288034","messageId":"1464799289-7639-17-git-send-email-vascomalmeida@sapo.pt","threadId":"42506","inReplyTo":"1464799289-7639-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v3 16/39] i18n: rebase-interactive: mark comments of squash for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-06-01T16:41:06Z","receivedAt":"2016-06-01T16:41:06Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Mark comment messages of squash/fixup file ($squash_msg) for\ntranslation.\n\nHelper functions this_nth_commit_message and skip_nth_commit_message\nreplace the previous method of making the comment messages (such as\n\"This is the 2nd commit message:\") aided by nth_string helper function.\nThis step was taken as a workaround to enabled translation of entire\nsentences. However, doesn't change any text seen in English by the user,\nexcept for string \"The first commit's message is:\" which was changed to\nmatch the style of other instances.\n\nThe test t3404-rebase-interactive.sh resorts to set_fake_editor which\ndidn't account for GETTEXT_POISON. Fix it by assuming success when we\nfind dummy gettext poison output where was supposed to find the first\ncomment line \"This is a combination of $count commits.\".\n\nFor that same message, use plural aware eval_ngettext instead of\neval_gettext, since other languages have more complex plural forms.\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n git-rebase--interactive.sh | 69 +++++++++++++++++++++++++++++++++++++---------\n t/lib-rebase.sh            |  1 +\n 2 files changed, 57 insertions(+), 13 deletions(-)\n\ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex e132f07..a545d92 100644\n--- a/git-rebase--interactive.sh\n+++ b/git-rebase--interactive.sh\n@@ -402,12 +402,52 @@ pick_one_preserving_merges () {\n \tesac\n }\n \n-nth_string () {\n-\tcase \"$1\" in\n-\t*1[0-9]|*[04-9]) echo \"$1\"th;;\n-\t*1) echo \"$1\"st;;\n-\t*2) echo \"$1\"nd;;\n-\t*3) echo \"$1\"rd;;\n+this_nth_commit_message () {\n+\tn=$1\n+\tcase \"$n\" in\n+\t1) gettext \"This is the 1st commit message:\";;\n+\t2) gettext \"This is the 2nd commit message:\";;\n+\t3) gettext \"This is the 3rd commit message:\";;\n+\t4) gettext \"This is the 4th commit message:\";;\n+\t5) gettext \"This is the 5th commit message:\";;\n+\t6) gettext \"This is the 6th commit message:\";;\n+\t7) gettext \"This is the 7th commit message:\";;\n+\t8) gettext \"This is the 8th commit message:\";;\n+\t9) gettext \"This is the 9th commit message:\";;\n+\t10) gettext \"This is the 10th commit message:\";;\n+\t# TRANSLATORS: if the language you are translating into\n+\t# doesn't allow you to compose a sentence in this fashion,\n+\t# consider translating as if this and the following few strings\n+\t# were \"This is the commit message ${n}:\"\n+\t*1[0-9]|*[04-9]) eval_gettext \"This is the \\${n}th commit message:\";;\n+\t*1) eval_gettext \"This is the \\${n}st commit message:\";;\n+\t*2) eval_gettext \"This is the \\${n}nd commit message:\";;\n+\t*3) eval_gettext \"This is the \\${n}rd commit message:\";;\n+\t*) eval_gettext \"This is the commit message \\${n}:\";;\n+\tesac\n+}\n+skip_nth_commit_message () {\n+\tn=$1\n+\tcase \"$n\" in\n+\t1) gettext \"The 1st commit message will be skipped:\";;\n+\t2) gettext \"The 2nd commit message will be skipped:\";;\n+\t3) gettext \"The 3rd commit message will be skipped:\";;\n+\t4) gettext \"The 4th commit message will be skipped:\";;\n+\t5) gettext \"The 5th commit message will be skipped:\";;\n+\t6) gettext \"The 6th commit message will be skipped:\";;\n+\t7) gettext \"The 7th commit message will be skipped:\";;\n+\t8) gettext \"The 8th commit message will be skipped:\";;\n+\t9) gettext \"The 9th commit message will be skipped:\";;\n+\t10) gettext \"The 10th commit message will be skipped:\";;\n+\t# TRANSLATORS: if the language you are translating into\n+\t# doesn't allow you to compose a sentence in this fashion,\n+\t# consider translating as if this and the following few strings\n+\t# were \"The commit message ${n} will be skipped:\"\n+\t*1[0-9]|*[04-9]) eval_gettext \"The \\${n}th commit message will be skipped:\";;\n+\t*1) eval_gettext \"The \\${n}st commit message will be skipped:\";;\n+\t*2) eval_gettext \"The \\${n}nd commit message will be skipped:\";;\n+\t*3) eval_gettext \"The \\${n}rd commit message will be skipped:\";;\n+\t*) eval_gettext \"The commit message \\${n} will be skipped:\";;\n \tesac\n }\n \n@@ -415,20 +455,23 @@ update_squash_messages () {\n \tif test -f \"$squash_msg\"; then\n \t\tmv \"$squash_msg\" \"$squash_msg\".bak || exit\n \t\tcount=$(($(sed -n \\\n-\t\t\t-e \"1s/^. This is a combination of \\(.*\\) commits\\./\\1/p\" \\\n+\t\t\t-e \"1s/^$comment_char.*\\([0-9][0-9]*\\).*/\\1/p\" \\\n \t\t\t-e \"q\" < \"$squash_msg\".bak)+1))\n \t\t{\n-\t\t\tprintf '%s\\n' \"$comment_char This is a combination of $count commits.\"\n+\t\t\tprintf '%s\\n' \"$comment_char $(eval_ngettext \\\n+\t\t\t\t\"This is a combination of \\$count commit.\" \\\n+\t\t\t\t\"This is a combination of \\$count commits.\" \\\n+\t\t\t\t$count)\"\n \t\t\tsed -e 1d -e '2,/^./{\n \t\t\t\t/^$/d\n \t\t\t}' <\"$squash_msg\".bak\n \t\t} >\"$squash_msg\"\n \telse\n-\t\tcommit_message HEAD > \"$fixup_msg\" || die \"Cannot write $fixup_msg\"\n+\t\tcommit_message HEAD > \"$fixup_msg\" || die \"$(gettext \"Cannot write \\$fixup_msg\")\"\n \t\tcount=2\n \t\t{\n-\t\t\tprintf '%s\\n' \"$comment_char This is a combination of 2 commits.\"\n-\t\t\tprintf '%s\\n' \"$comment_char The first commit's message is:\"\n+\t\t\tprintf '%s\\n' \"$comment_char $(gettext \"This is a combination of 2 commits.\")\"\n+\t\t\tprintf '%s\\n' \"$comment_char $(gettext \"This is the 1st commit message:\")\"\n \t\t\techo\n \t\t\tcat \"$fixup_msg\"\n \t\t} >\"$squash_msg\"\n@@ -437,13 +480,13 @@ update_squash_messages () {\n \tsquash)\n \t\trm -f \"$fixup_msg\"\n \t\techo\n-\t\tprintf '%s\\n' \"$comment_char This is the $(nth_string $count) commit message:\"\n+\t\tprintf '%s\\n' \"$comment_char $(this_nth_commit_message $count)\"\n \t\techo\n \t\tcommit_message $2\n \t\t;;\n \tfixup)\n \t\techo\n-\t\tprintf '%s\\n' \"$comment_char The $(nth_string $count) commit message will be skipped:\"\n+\t\tprintf '%s\\n' \"$comment_char $(skip_nth_commit_message $count)\"\n \t\techo\n \t\t# Change the space after the comment character to TAB:\n \t\tcommit_message $2 | git stripspace --comment-lines | sed -e 's/ /\t/'\ndiff --git a/t/lib-rebase.sh b/t/lib-rebase.sh\nindex 9a96e15..25a77ee 100644\n--- a/t/lib-rebase.sh\n+++ b/t/lib-rebase.sh\n@@ -29,6 +29,7 @@ set_fake_editor () {\n \t*/COMMIT_EDITMSG)\n \t\ttest -z \"$EXPECT_HEADER_COUNT\" ||\n \t\t\ttest \"$EXPECT_HEADER_COUNT\" = \"$(sed -n '1s/^# This is a combination of \\(.*\\) commits\\./\\1/p' < \"$1\")\" ||\n+\t\t\ttest \"# # GETTEXT POISON #\" = \"$(sed -n '1p' < \"$1\")\" ||\n \t\t\texit\n \t\ttest -z \"$FAKE_COMMIT_MESSAGE\" || echo \"$FAKE_COMMIT_MESSAGE\" > \"$1\"\n \t\ttest -z \"$FAKE_COMMIT_AMEND\" || echo \"$FAKE_COMMIT_AMEND\" >> \"$1\"\n-- \n2.7.3\n"},{"id":"288039","messageId":"1464799289-7639-18-git-send-email-vascomalmeida@sapo.pt","threadId":"42506","inReplyTo":"1464799289-7639-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v3 17/39] i18n: setup: mark strings for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-06-01T16:41:07Z","receivedAt":"2016-06-01T16:41:07Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Update tests that compare the strings newly marked for translation to\nsucceed when running under GETTEXT_POISON.\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n setup.c                        | 16 ++++++++--------\n t/t1506-rev-parse-diagnosis.sh |  2 +-\n t/t4208-log-magic-pathspec.sh  |  4 ++--\n 3 files changed, 11 insertions(+), 11 deletions(-)\n\ndiff --git a/setup.c b/setup.c\nindex c86bf5c..6d0e0c9 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -157,8 +157,8 @@ static void NORETURN die_verify_filename(const char *prefix,\n \t\t\t\t\t int diagnose_misspelt_rev)\n {\n \tif (!diagnose_misspelt_rev)\n-\t\tdie(\"%s: no such path in the working tree.\\n\"\n-\t\t    \"Use 'git <command> -- <path>...' to specify paths that do not exist locally.\",\n+\t\tdie(_(\"%s: no such path in the working tree.\\n\"\n+\t\t      \"Use 'git <command> -- <path>...' to specify paths that do not exist locally.\"),\n \t\t    arg);\n \t/*\n \t * Saying \"'(icase)foo' does not exist in the index\" when the\n@@ -170,9 +170,9 @@ static void NORETURN die_verify_filename(const char *prefix,\n \t\tmaybe_die_on_misspelt_object_name(arg, prefix);\n \n \t/* ... or fall back the most general message. */\n-\tdie(\"ambiguous argument '%s': unknown revision or path not in the working tree.\\n\"\n-\t    \"Use '--' to separate paths from revisions, like this:\\n\"\n-\t    \"'git <command> [<revision>...] -- [<file>...]'\", arg);\n+\tdie(_(\"ambiguous argument '%s': unknown revision or path not in the working tree.\\n\"\n+\t      \"Use '--' to separate paths from revisions, like this:\\n\"\n+\t      \"'git <command> [<revision>...] -- [<file>...]'\"), arg);\n \n }\n \n@@ -220,9 +220,9 @@ void verify_non_filename(const char *prefix, const char *arg)\n \t\treturn; /* flag */\n \tif (!check_filename(prefix, arg))\n \t\treturn;\n-\tdie(\"ambiguous argument '%s': both revision and filename\\n\"\n-\t    \"Use '--' to separate paths from revisions, like this:\\n\"\n-\t    \"'git <command> [<revision>...] -- [<file>...]'\", arg);\n+\tdie(_(\"ambiguous argument '%s': both revision and filename\\n\"\n+\t      \"Use '--' to separate paths from revisions, like this:\\n\"\n+\t      \"'git <command> [<revision>...] -- [<file>...]'\"), arg);\n }\n \n int get_common_dir(struct strbuf *sb, const char *gitdir)\ndiff --git a/t/t1506-rev-parse-diagnosis.sh b/t/t1506-rev-parse-diagnosis.sh\nindex 86c2ff2..79a0251 100755\n--- a/t/t1506-rev-parse-diagnosis.sh\n+++ b/t/t1506-rev-parse-diagnosis.sh\n@@ -106,7 +106,7 @@ test_expect_success 'incorrect revision id' '\n \ttest_must_fail git rev-parse foobar:file.txt 2>error &&\n \tgrep \"Invalid object name '\"'\"'foobar'\"'\"'.\" error &&\n \ttest_must_fail git rev-parse foobar 2> error &&\n-\tgrep \"unknown revision or path not in the working tree.\" error\n+\ttest_i18ngrep \"unknown revision or path not in the working tree.\" error\n '\n \n test_expect_success 'incorrect file in sha1:path' '\ndiff --git a/t/t4208-log-magic-pathspec.sh b/t/t4208-log-magic-pathspec.sh\nindex d8f23f4..001343e 100755\n--- a/t/t4208-log-magic-pathspec.sh\n+++ b/t/t4208-log-magic-pathspec.sh\n@@ -18,7 +18,7 @@ test_expect_success '\"git log :/\" should not be ambiguous' '\n test_expect_success '\"git log :/a\" should be ambiguous (applied both rev and worktree)' '\n \t: >a &&\n \ttest_must_fail git log :/a 2>error &&\n-\tgrep ambiguous error\n+\ttest_i18ngrep ambiguous error\n '\n \n test_expect_success '\"git log :/a -- \" should not be ambiguous' '\n@@ -31,7 +31,7 @@ test_expect_success '\"git log -- :/a\" should not be ambiguous' '\n \n test_expect_success '\"git log :\" should be ambiguous' '\n \ttest_must_fail git log : 2>error &&\n-\tgrep ambiguous error\n+\ttest_i18ngrep ambiguous error\n '\n \n test_expect_success 'git log -- :' '\n-- \n2.7.3\n"},{"id":"288036","messageId":"1464799289-7639-19-git-send-email-vascomalmeida@sapo.pt","threadId":"42506","inReplyTo":"1464799289-7639-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v3 18/39] tests: use test_i18n* functions to suppress false positives","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-06-01T16:41:08Z","receivedAt":"2016-06-01T16:41:08Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"The test functions test_i18ncmp and test_i18ngrep pretend success if run\nunder GETTEXT_POISON. By using those functions to test output which is\ncorrectly marked as translatable, enables one to detect if the strings\nnewly marked for translation are from plumbing output. If they are\nindeed from plumbing, the test would fail, and the string should be\nunmarked, since it is not seen by users.\n\nThus, it is productive to not have false positives when running the test\nunder GETTEXT_POISON. This commit replaces normal test functions by\ntheir i18n aware variants in use-cases know to be correctly marked for\ntranslation, suppressing false positives.\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n t/t0008-ignores.sh                |  4 ++--\n t/t1300-repo-config.sh            |  8 ++++----\n t/t1307-config-blob.sh            |  5 +----\n t/t1308-config-set.sh             |  4 ++--\n t/t1400-update-ref.sh             |  2 +-\n t/t2010-checkout-ambiguous.sh     |  2 +-\n t/t2018-checkout-branch.sh        |  2 +-\n t/t3200-branch.sh                 |  6 +++---\n t/t3201-branch-contains.sh        |  2 +-\n t/t3320-notes-merge-worktrees.sh  |  2 +-\n t/t5505-remote.sh                 |  2 +-\n t/t5510-fetch.sh                  |  2 +-\n t/t5523-push-upstream.sh          |  4 ++--\n t/t5536-fetch-conflicts.sh        |  4 ++--\n t/t6301-for-each-ref-errors.sh    | 10 +++++-----\n t/t7063-status-untracked-cache.sh |  2 +-\n t/t7102-reset.sh                  |  4 ++--\n t/t7400-submodule-basic.sh        |  2 +-\n t/t7403-submodule-sync.sh         |  4 ++--\n t/t7406-submodule-update.sh       | 10 +++++-----\n t/t7508-status.sh                 |  4 ++--\n 21 files changed, 41 insertions(+), 44 deletions(-)\n\ndiff --git a/t/t0008-ignores.sh b/t/t0008-ignores.sh\nindex b425f3a..d27f438 100755\n--- a/t/t0008-ignores.sh\n+++ b/t/t0008-ignores.sh\n@@ -34,7 +34,7 @@ expect_from_stdin () {\n test_stderr () {\n \texpected=\"$1\"\n \texpect_in stderr \"$1\" &&\n-\ttest_cmp \"$HOME/expected-stderr\" \"$HOME/stderr\"\n+\ttest_i18ncmp \"$HOME/expected-stderr\" \"$HOME/stderr\"\n }\n \n broken_c_unquote () {\n@@ -47,7 +47,7 @@ broken_c_unquote_verbose () {\n \n stderr_contains () {\n \tregexp=\"$1\"\n-\tif grep \"$regexp\" \"$HOME/stderr\"\n+\tif test_i18ngrep \"$regexp\" \"$HOME/stderr\"\n \tthen\n \t\treturn 0\n \telse\ndiff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh\nindex d934a24..923bfc5 100755\n--- a/t/t1300-repo-config.sh\n+++ b/t/t1300-repo-config.sh\n@@ -886,7 +886,7 @@ test_expect_success !MINGW 'get --path copes with unset $HOME' '\n \t\tgit config --get --path path.normal >>result &&\n \t\tgit config --get --path path.trailingtilde >>result\n \t) &&\n-\tgrep \"[Ff]ailed to expand.*~/\" msg &&\n+\ttest_i18ngrep \"[Ff]ailed to expand.*~/\" msg &&\n \ttest_cmp expect result\n '\n \n@@ -1126,7 +1126,7 @@ test_expect_success 'barf on syntax error' '\n \tkey garbage\n \tEOF\n \ttest_must_fail git config --get section.key >actual 2>error &&\n-\tgrep \" line 3 \" error\n+\ttest_i18ngrep \" line 3 \" error\n '\n \n test_expect_success 'barf on incomplete section header' '\n@@ -1136,7 +1136,7 @@ test_expect_success 'barf on incomplete section header' '\n \tkey = value\n \tEOF\n \ttest_must_fail git config --get section.key >actual 2>error &&\n-\tgrep \" line 2 \" error\n+\ttest_i18ngrep \" line 2 \" error\n '\n \n test_expect_success 'barf on incomplete string' '\n@@ -1146,7 +1146,7 @@ test_expect_success 'barf on incomplete string' '\n \tkey = \"value string\n \tEOF\n \ttest_must_fail git config --get section.key >actual 2>error &&\n-\tgrep \" line 3 \" error\n+\ttest_i18ngrep \" line 3 \" error\n '\n \n test_expect_success 'urlmatch' '\ndiff --git a/t/t1307-config-blob.sh b/t/t1307-config-blob.sh\nindex 3c6791e..eed31ff 100755\n--- a/t/t1307-config-blob.sh\n+++ b/t/t1307-config-blob.sh\n@@ -61,10 +61,7 @@ test_expect_success 'parse errors in blobs are properly attributed' '\n \tgit commit -m broken &&\n \n \ttest_must_fail git config --blob=HEAD:config some.value 2>err &&\n-\n-\t# just grep for our token as the exact error message is likely to\n-\t# change or be internationalized\n-\tgrep \"HEAD:config\" err\n+\ttest_i18ngrep \"HEAD:config\" err\n '\n \n test_expect_success 'can parse blob ending with CR' '\ndiff --git a/t/t1308-config-set.sh b/t/t1308-config-set.sh\nindex 005d66d..cd62063 100755\n--- a/t/t1308-config-set.sh\n+++ b/t/t1308-config-set.sh\n@@ -197,14 +197,14 @@ test_expect_success 'proper error on error in default config files' '\n \techo \"[\" >>.git/config &&\n \techo \"fatal: bad config line 34 in file .git/config\" >expect &&\n \ttest_expect_code 128 test-config get_value foo.bar 2>actual &&\n-\ttest_cmp expect actual\n+\ttest_i18ncmp expect actual\n '\n \n test_expect_success 'proper error on error in custom config files' '\n \techo \"[\" >>syntax-error &&\n \techo \"fatal: bad config line 1 in file syntax-error\" >expect &&\n \ttest_expect_code 128 test-config configset_get_value foo.bar syntax-error 2>actual &&\n-\ttest_cmp expect actual\n+\ttest_i18ncmp expect actual\n '\n \n test_expect_success 'check line errors for malformed values' '\ndiff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh\nindex af1b20d..75fa654 100755\n--- a/t/t1400-update-ref.sh\n+++ b/t/t1400-update-ref.sh\n@@ -361,7 +361,7 @@ test_expect_success 'stdin test setup' '\n \n test_expect_success '-z fails without --stdin' '\n \ttest_must_fail git update-ref -z $m $m $m 2>err &&\n-\tgrep \"usage: git update-ref\" err\n+\ttest_i18ngrep \"usage: git update-ref\" err\n '\n \n test_expect_success 'stdin works with no input' '\ndiff --git a/t/t2010-checkout-ambiguous.sh b/t/t2010-checkout-ambiguous.sh\nindex 87bdf9c..e76e84a 100755\n--- a/t/t2010-checkout-ambiguous.sh\n+++ b/t/t2010-checkout-ambiguous.sh\n@@ -49,7 +49,7 @@ test_expect_success 'disambiguate checking out from a tree-ish' '\n \n test_expect_success 'accurate error message with more than one ref' '\n \ttest_must_fail git checkout HEAD master -- 2>actual &&\n-\tgrep 2 actual &&\n+\ttest_i18ngrep 2 actual &&\n \ttest_i18ngrep \"one reference expected, 2 given\" actual\n '\n \ndiff --git a/t/t2018-checkout-branch.sh b/t/t2018-checkout-branch.sh\nindex 2741262..2131fb2 100755\n--- a/t/t2018-checkout-branch.sh\n+++ b/t/t2018-checkout-branch.sh\n@@ -124,7 +124,7 @@ test_expect_success 'checkout -b to @{-1} fails with the right branch name' '\n \tgit checkout branch2 &&\n \techo  >expect \"fatal: A branch named '\\''branch1'\\'' already exists.\" &&\n \ttest_must_fail git checkout -b @{-1} 2>actual &&\n-\ttest_cmp expect actual\n+\ttest_i18ncmp expect actual\n '\n \n test_expect_success 'checkout -B to an existing branch resets branch to HEAD' '\ndiff --git a/t/t3200-branch.sh b/t/t3200-branch.sh\nindex f3e3b6c..ac9c764 100755\n--- a/t/t3200-branch.sh\n+++ b/t/t3200-branch.sh\n@@ -550,7 +550,7 @@ If you wanted to make '\"'master'\"' track '\"'origin/master'\"', do this:\n     git branch -d origin/master\n     git branch --set-upstream-to origin/master\n EOF\n-\ttest_cmp expected actual\n+\ttest_i18ncmp expected actual\n '\n \n test_expect_success '--set-upstream with two args only shows the deprecation message' '\n@@ -559,7 +559,7 @@ test_expect_success '--set-upstream with two args only shows the deprecation mes\n \tcat >expected <<EOF &&\n The --set-upstream flag is deprecated and will be removed. Consider using --track or --set-upstream-to\n EOF\n-\ttest_cmp expected actual\n+\ttest_i18ncmp expected actual\n '\n \n test_expect_success '--set-upstream with one arg only shows the deprecation message if the branch existed' '\n@@ -568,7 +568,7 @@ test_expect_success '--set-upstream with one arg only shows the deprecation mess\n \tcat >expected <<EOF &&\n The --set-upstream flag is deprecated and will be removed. Consider using --track or --set-upstream-to\n EOF\n-\ttest_cmp expected actual\n+\ttest_i18ncmp expected actual\n '\n \n test_expect_success '--set-upstream-to notices an error to set branch as own upstream' '\ndiff --git a/t/t3201-branch-contains.sh b/t/t3201-branch-contains.sh\nindex 912a663..7f3ec47 100755\n--- a/t/t3201-branch-contains.sh\n+++ b/t/t3201-branch-contains.sh\n@@ -156,7 +156,7 @@ test_expect_success 'branch --merged with --verbose' '\n \t* topic  2c939f4 [ahead 1] foo\n \t  zzz    c77a0a9 second on master\n \tEOF\n-\ttest_cmp expect actual\n+\ttest_i18ncmp expect actual\n '\n \n test_done\ndiff --git a/t/t3320-notes-merge-worktrees.sh b/t/t3320-notes-merge-worktrees.sh\nindex 1f71d58..522157b 100755\n--- a/t/t3320-notes-merge-worktrees.sh\n+++ b/t/t3320-notes-merge-worktrees.sh\n@@ -52,7 +52,7 @@ test_expect_success 'merge z into y while mid-merge in another workdir fails' '\n \t\tcd worktree &&\n \t\tgit config core.notesRef refs/notes/y &&\n \t\ttest_must_fail git notes merge z 2>err &&\n-\t\tgrep \"A notes merge into refs/notes/y is already in-progress at\" err\n+\t\ttest_i18ngrep \"A notes merge into refs/notes/y is already in-progress at\" err\n \t) &&\n \ttest_path_is_missing .git/worktrees/worktree/NOTES_MERGE_REF\n '\ndiff --git a/t/t5505-remote.sh b/t/t5505-remote.sh\nindex dd2e6ce..8198d8e 100755\n--- a/t/t5505-remote.sh\n+++ b/t/t5505-remote.sh\n@@ -1182,7 +1182,7 @@ test_expect_success 'extra args: setup' '\n test_extra_arg () {\n \ttest_expect_success \"extra args: $*\" \"\n \t\ttest_must_fail git remote $* bogus_extra_arg 2>actual &&\n-\t\tgrep '^usage:' actual\n+\t\ttest_i18ngrep '^usage:' actual\n \t\"\n }\n \ndiff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh\nindex 454d896..88076da 100755\n--- a/t/t5510-fetch.sh\n+++ b/t/t5510-fetch.sh\n@@ -644,7 +644,7 @@ test_expect_success 'fetch --prune prints the remotes url' '\n \t\tgit fetch --prune origin 2>&1 | head -n1 >../actual\n \t) &&\n \techo \"From ${D}/.\" >expect &&\n-\ttest_cmp expect actual\n+\ttest_i18ncmp expect actual\n '\n \n test_expect_success 'branchname D/F conflict resolved by --prune' '\ndiff --git a/t/t5523-push-upstream.sh b/t/t5523-push-upstream.sh\nindex 3683df1..4a7b98b 100755\n--- a/t/t5523-push-upstream.sh\n+++ b/t/t5523-push-upstream.sh\n@@ -75,7 +75,7 @@ test_expect_success TTY 'progress messages go to tty' '\n \tensure_fresh_upstream &&\n \n \ttest_terminal git push -u upstream master >out 2>err &&\n-\tgrep \"Writing objects\" err\n+\ttest_i18ngrep \"Writing objects\" err\n '\n \n test_expect_success 'progress messages do not go to non-tty' '\n@@ -91,7 +91,7 @@ test_expect_success 'progress messages go to non-tty (forced)' '\n \n \t# force progress messages to stderr, even though it is non-tty\n \tgit push -u --progress upstream master >out 2>err &&\n-\tgrep \"Writing objects\" err\n+\ttest_i18ngrep \"Writing objects\" err\n '\n \n test_expect_success TTY 'push -q suppresses progress' '\ndiff --git a/t/t5536-fetch-conflicts.sh b/t/t5536-fetch-conflicts.sh\nindex 6c5d3a4..2e42cf3 100755\n--- a/t/t5536-fetch-conflicts.sh\n+++ b/t/t5536-fetch-conflicts.sh\n@@ -22,8 +22,8 @@ verify_stderr () {\n \tcat >expected &&\n \t# We're not interested in the error\n \t# \"fatal: The remote end hung up unexpectedly\":\n-\tgrep -E '^(fatal|warning):' <error | grep -v 'hung up' >actual | sort &&\n-\ttest_cmp expected actual\n+\ttest_i18ngrep -E '^(fatal|warning):' <error | grep -v 'hung up' >actual | sort &&\n+\ttest_i18ncmp expected actual\n }\n \n test_expect_success 'setup' '\ndiff --git a/t/t6301-for-each-ref-errors.sh b/t/t6301-for-each-ref-errors.sh\nindex cdb67a0..c734ce2 100755\n--- a/t/t6301-for-each-ref-errors.sh\n+++ b/t/t6301-for-each-ref-errors.sh\n@@ -20,8 +20,8 @@ test_expect_success 'Broken refs are reported correctly' '\n \ttest_when_finished \"rm -f .git/$r\" &&\n \techo \"warning: ignoring broken ref $r\" >broken-err &&\n \tgit for-each-ref >out 2>err &&\n-\ttest_cmp full-list out &&\n-\ttest_cmp broken-err err\n+\ttest_i18ncmp full-list out &&\n+\ttest_i18ncmp broken-err err\n '\n \n test_expect_success 'NULL_SHA1 refs are reported correctly' '\n@@ -31,10 +31,10 @@ test_expect_success 'NULL_SHA1 refs are reported correctly' '\n \techo \"warning: ignoring broken ref $r\" >zeros-err &&\n \tgit for-each-ref >out 2>err &&\n \ttest_cmp full-list out &&\n-\ttest_cmp zeros-err err &&\n+\ttest_i18ncmp zeros-err err &&\n \tgit for-each-ref --format=\"%(objectname) %(refname)\" >brief-out 2>brief-err &&\n \ttest_cmp brief-list brief-out &&\n-\ttest_cmp zeros-err brief-err\n+\ttest_i18ncmp zeros-err brief-err\n '\n \n test_expect_success 'Missing objects are reported correctly' '\n@@ -43,7 +43,7 @@ test_expect_success 'Missing objects are reported correctly' '\n \ttest_when_finished \"rm -f .git/$r\" &&\n \techo \"fatal: missing object $MISSING for $r\" >missing-err &&\n \ttest_must_fail git for-each-ref 2>err &&\n-\ttest_cmp missing-err err &&\n+\ttest_i18ncmp missing-err err &&\n \t(\n \t\tcat brief-list &&\n \t\techo \"$MISSING $r\"\ndiff --git a/t/t7063-status-untracked-cache.sh b/t/t7063-status-untracked-cache.sh\nindex a971884..38b3890 100755\n--- a/t/t7063-status-untracked-cache.sh\n+++ b/t/t7063-status-untracked-cache.sh\n@@ -643,7 +643,7 @@ test_expect_success 'test ident field is working' '\n \tcp -R done dthree dtwo four three ../other_worktree &&\n \tGIT_WORK_TREE=../other_worktree git status 2>../err &&\n \techo \"warning: Untracked cache is disabled on this system or location.\" >../expect &&\n-\ttest_cmp ../expect ../err\n+\ttest_i18ncmp ../expect ../err\n '\n \n test_done\ndiff --git a/t/t7102-reset.sh b/t/t7102-reset.sh\nindex 98bcfe2..86f23be 100755\n--- a/t/t7102-reset.sh\n+++ b/t/t7102-reset.sh\n@@ -66,14 +66,14 @@ test_expect_success 'reset --hard message' '\n \thex=$(git log -1 --format=\"%h\") &&\n \tgit reset --hard > .actual &&\n \techo HEAD is now at $hex $(commit_msg) > .expected &&\n-\ttest_cmp .expected .actual\n+\ttest_i18ncmp .expected .actual\n '\n \n test_expect_success 'reset --hard message (ISO8859-1 logoutputencoding)' '\n \thex=$(git log -1 --format=\"%h\") &&\n \tgit -c \"i18n.logOutputEncoding=$test_encoding\" reset --hard > .actual &&\n \techo HEAD is now at $hex $(commit_msg $test_encoding) > .expected &&\n-\ttest_cmp .expected .actual\n+\ttest_i18ncmp .expected .actual\n '\n \n >.diff_expect\ndiff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh\nindex 3570f7b..b77cce8 100755\n--- a/t/t7400-submodule-basic.sh\n+++ b/t/t7400-submodule-basic.sh\n@@ -942,7 +942,7 @@ test_expect_success 'submodule deinit from subdirectory' '\n \t\tcd sub &&\n \t\tgit submodule deinit ../init >../output\n \t) &&\n-\tgrep \"\\\\.\\\\./init\" output &&\n+\ttest_i18ngrep \"\\\\.\\\\./init\" output &&\n \ttest -z \"$(git config --get-regexp \"submodule\\.example\\.\")\" &&\n \ttest -n \"$(git config --get-regexp \"submodule\\.example2\\.\")\" &&\n \ttest -f example2/.git &&\ndiff --git a/t/t7403-submodule-sync.sh b/t/t7403-submodule-sync.sh\nindex 79bc135..b8690b1 100755\n--- a/t/t7403-submodule-sync.sh\n+++ b/t/t7403-submodule-sync.sh\n@@ -157,7 +157,7 @@ test_expect_success '\"git submodule sync\" should update submodule URLs - subdire\n \t\tcd sub &&\n \t\tgit submodule sync >../../output\n \t) &&\n-\tgrep \"\\\\.\\\\./submodule\" output &&\n+\ttest_i18ngrep \"\\\\.\\\\./submodule\" output &&\n \ttest -d \"$(\n \t\tcd super-clone/submodule &&\n \t\tgit config remote.origin.url\n@@ -188,7 +188,7 @@ test_expect_success '\"git submodule sync --recursive\" should update all submodul\n \t\tcd sub &&\n \t\tgit submodule sync --recursive >../../output\n \t) &&\n-\tgrep \"\\\\.\\\\./submodule/sub-submodule\" output &&\n+\ttest_i18ngrep \"\\\\.\\\\./submodule/sub-submodule\" output &&\n \ttest -d \"$(\n \t\tcd super-clone/submodule &&\n \t\tgit config remote.origin.url\ndiff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh\nindex 5f27879..88e9750 100755\n--- a/t/t7406-submodule-update.sh\n+++ b/t/t7406-submodule-update.sh\n@@ -136,8 +136,8 @@ test_expect_success 'submodule update --init --recursive from subdirectory' '\n \t cd tmp &&\n \t git submodule update --init --recursive ../super >../../actual 2>../../actual2\n \t) &&\n-\ttest_cmp expect actual &&\n-\ttest_cmp expect2 actual2\n+\ttest_i18ncmp expect actual &&\n+\ttest_i18ncmp expect2 actual2\n '\n \n apos=\"'\";\n@@ -370,7 +370,7 @@ test_expect_success 'submodule update - command in .git/config catches failure'\n \t(cd super &&\n \t test_must_fail git submodule update submodule 2>../actual\n \t) &&\n-\ttest_cmp actual expect\n+\ttest_i18ncmp actual expect\n '\n \n cat << EOF >expect\n@@ -388,7 +388,7 @@ test_expect_success 'submodule update - command in .git/config catches failure -\n \t mkdir tmp && cd tmp &&\n \t test_must_fail git submodule update ../submodule 2>../../actual\n \t) &&\n-\ttest_cmp actual expect\n+\ttest_i18ncmp actual expect\n '\n \n cat << EOF >expect\n@@ -408,7 +408,7 @@ test_expect_success 'recursive submodule update - command in .git/config catches\n \t mkdir -p tmp && cd tmp &&\n \t test_must_fail git submodule update --recursive ../super 2>../../actual\n \t) &&\n-\ttest_cmp actual expect\n+\ttest_i18ncmp actual expect\n '\n \n test_expect_success 'submodule init does not copy command into .git/config' '\ndiff --git a/t/t7508-status.sh b/t/t7508-status.sh\nindex c3ed7cb..b3bdd16 100755\n--- a/t/t7508-status.sh\n+++ b/t/t7508-status.sh\n@@ -1377,7 +1377,7 @@ EOF\n \tgit config --add -f .gitmodules submodule.subname.ignore all &&\n \tgit config --add -f .gitmodules submodule.subname.path sm &&\n \tgit status > output &&\n-\ttest_cmp expect output &&\n+\ttest_i18ncmp expect output &&\n \tgit config -f .gitmodules  --remove-section submodule.subname\n '\n \n@@ -1387,7 +1387,7 @@ test_expect_success '.git/config ignore=all suppresses unstaged submodule summar\n \tgit config --add submodule.subname.ignore all &&\n \tgit config --add submodule.subname.path sm &&\n \tgit status > output &&\n-\ttest_cmp expect output &&\n+\ttest_i18ncmp expect output &&\n \tgit config --remove-section submodule.subname &&\n \tgit config -f .gitmodules  --remove-section submodule.subname\n '\n-- \n2.7.3\n"},{"id":"288038","messageId":"1464799289-7639-20-git-send-email-vascomalmeida@sapo.pt","threadId":"42506","inReplyTo":"1464799289-7639-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v3 19/39] tests: unpack-trees: update to use test_i18n* functions","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-06-01T16:41:09Z","receivedAt":"2016-06-01T16:41:09Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Use functions test_i18ncmp and test_i18ngrep to successfully pass tests\nrunning under GETTEXT_POISON.\n\nThe output strings compared to in these test were marked for translation\nin ed47fdf (\"i18n: unpack-trees: mark strings for translation\",\n2016-04-09) and later improved in 2e3926b (\"i18n: unpack-trees: avoid\nsubstituting only a verb in sentences\", 2016-05-12).\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n t/t1011-read-tree-sparse-checkout.sh | 2 +-\n t/t3400-rebase.sh                    | 4 ++--\n t/t3404-rebase-interactive.sh        | 4 ++--\n t/t7607-merge-overwrite.sh           | 2 +-\n 4 files changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/t/t1011-read-tree-sparse-checkout.sh b/t/t1011-read-tree-sparse-checkout.sh\nindex 0c74bee..3583105 100755\n--- a/t/t1011-read-tree-sparse-checkout.sh\n+++ b/t/t1011-read-tree-sparse-checkout.sh\n@@ -247,7 +247,7 @@ error: The following untracked working tree files would be overwritten by checko\n Please move or remove them before you can switch branches.\n Aborting\n EOF\n-\ttest_cmp expected actual\n+\ttest_i18ncmp expected actual\n '\n \n test_expect_success 'checkout without --ignore-skip-worktree-bits' '\ndiff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh\nindex 47b5682..f5fd15e 100755\n--- a/t/t3400-rebase.sh\n+++ b/t/t3400-rebase.sh\n@@ -136,8 +136,8 @@ test_expect_success 'setup: recover' '\n test_expect_success 'Show verbose error when HEAD could not be detached' '\n \t>B &&\n \ttest_must_fail git rebase topic 2>output.err >output.out &&\n-\tgrep \"The following untracked working tree files would be overwritten by checkout:\" output.err &&\n-\tgrep B output.err\n+\ttest_i18ngrep \"The following untracked working tree files would be overwritten by checkout:\" output.err &&\n+\ttest_i18ngrep B output.err\n '\n rm -f B\n \ndiff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh\nindex f4ccd10..8ac1868 100755\n--- a/t/t3404-rebase-interactive.sh\n+++ b/t/t3404-rebase-interactive.sh\n@@ -219,9 +219,9 @@ test_expect_success 'abort with error when new base cannot be checked out' '\n \tgit commit -m \"remove file in base\" &&\n \tset_fake_editor &&\n \ttest_must_fail git rebase -i master > output 2>&1 &&\n-\tgrep \"The following untracked working tree files would be overwritten by checkout:\" \\\n+\ttest_i18ngrep \"The following untracked working tree files would be overwritten by checkout:\" \\\n \t\toutput &&\n-\tgrep \"file1\" output &&\n+\ttest_i18ngrep \"file1\" output &&\n \ttest_path_is_missing .git/rebase-merge &&\n \tgit reset --hard HEAD^\n '\ndiff --git a/t/t7607-merge-overwrite.sh b/t/t7607-merge-overwrite.sh\nindex 758a623..e8ec54c 100755\n--- a/t/t7607-merge-overwrite.sh\n+++ b/t/t7607-merge-overwrite.sh\n@@ -125,7 +125,7 @@ test_expect_success 'will not overwrite untracked file in leading path' '\n \tcp important sub &&\n \tcp important sub2 &&\n \ttest_must_fail git merge sub 2>out &&\n-\ttest_cmp out expect &&\n+\ttest_i18ncmp out expect &&\n \ttest_path_is_missing .git/MERGE_HEAD &&\n \ttest_cmp important sub &&\n \ttest_cmp important sub2 &&\n-- \n2.7.3\n"},{"id":"288033","messageId":"1464799289-7639-21-git-send-email-vascomalmeida@sapo.pt","threadId":"42506","inReplyTo":"1464799289-7639-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v3 20/39] t9003: become resilient to GETTEXT_POISON","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-06-01T16:41:10Z","receivedAt":"2016-06-01T16:41:10Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"The test t9003-help-autocorrect.sh fails when run under GETTEXT_POISON,\nbecause it's expecting to filter out the original output. Accommodate\ngettext poison case by also filtering out the default simulated output.\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n t/t9003-help-autocorrect.sh | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t9003-help-autocorrect.sh b/t/t9003-help-autocorrect.sh\nindex dfe95c9..b1c7919 100755\n--- a/t/t9003-help-autocorrect.sh\n+++ b/t/t9003-help-autocorrect.sh\n@@ -31,10 +31,10 @@ test_expect_success 'autocorrect showing candidates' '\n \tgit config help.autocorrect 0 &&\n \n \ttest_must_fail git lfg 2>actual &&\n-\tsed -e \"1,/^Did you mean this/d\" actual | grep lgf &&\n+\tgrep \"^\tlgf\" actual &&\n \n \ttest_must_fail git distimdist 2>actual &&\n-\tsed -e \"1,/^Did you mean this/d\" actual | grep distimdistim\n+\tgrep \"^\tdistimdistim\" actual\n '\n \n test_expect_success 'autocorrect running commands' '\n-- \n2.7.3\n"},{"id":"288037","messageId":"1464799289-7639-22-git-send-email-vascomalmeida@sapo.pt","threadId":"42506","inReplyTo":"1464799289-7639-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v3 21/39] t4153: fix negated test_i18ngrep call","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-06-01T16:41:11Z","receivedAt":"2016-06-01T16:41:11Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"The function test_i18ngrep fakes success when run under GETTEXT_POISON.\nHence, running in the following manner will always fail under gettext\npoison:\n\n\t! test_i18ngrep expected actual\n\nUse correct syntax: test_i18ngrep ! expected actual\n\nFor other instance of this issue see 41ca19b (\"tests: fix negated\ntest_i18ngrep calls\", 2014-08-13).\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n t/t4153-am-resume-override-opts.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/t/t4153-am-resume-override-opts.sh b/t/t4153-am-resume-override-opts.sh\nindex 7c013d8..8ea22d1 100755\n--- a/t/t4153-am-resume-override-opts.sh\n+++ b/t/t4153-am-resume-override-opts.sh\n@@ -53,7 +53,7 @@ test_expect_success '--no-quiet overrides --quiet' '\n \t# Applying side1 will be quiet.\n \ttest_must_fail git am --quiet side[123].eml >out &&\n \ttest_path_is_dir .git/rebase-apply &&\n-\t! test_i18ngrep \"^Applying: \" out &&\n+\ttest_i18ngrep ! \"^Applying: \" out &&\n \techo side1 >file &&\n \tgit add file &&\n \n-- \n2.7.3\n"},{"id":"288041","messageId":"1464799289-7639-23-git-send-email-vascomalmeida@sapo.pt","threadId":"42506","inReplyTo":"1464799289-7639-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v3 22/39] t5523: use test_i18ngrep for negation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-06-01T16:41:12Z","receivedAt":"2016-06-01T16:41:12Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Replace the first form with the second one:\n\n\t! grep expected actual\n\ttest_i18ngrep ! expected actual\n\nThe latter syntax is supported by test_i18ngrep defined in\nt/test-lib.sh.\n\nAlthough the test already passes whether GETTEXT_POSION is enabled, use\nthe i18n grep variant for the sake of consistency and also to make\nobvious that those strings are subject to i18n.\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n t/t5523-push-upstream.sh | 8 ++++----\n 1 file changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/t/t5523-push-upstream.sh b/t/t5523-push-upstream.sh\nindex 4a7b98b..d6981ba 100755\n--- a/t/t5523-push-upstream.sh\n+++ b/t/t5523-push-upstream.sh\n@@ -83,7 +83,7 @@ test_expect_success 'progress messages do not go to non-tty' '\n \n \t# skip progress messages, since stderr is non-tty\n \tgit push -u upstream master >out 2>err &&\n-\t! grep \"Writing objects\" err\n+\ttest_i18ngrep ! \"Writing objects\" err\n '\n \n test_expect_success 'progress messages go to non-tty (forced)' '\n@@ -98,15 +98,15 @@ test_expect_success TTY 'push -q suppresses progress' '\n \tensure_fresh_upstream &&\n \n \ttest_terminal git push -u -q upstream master >out 2>err &&\n-\t! grep \"Writing objects\" err\n+\ttest_i18ngrep ! \"Writing objects\" err\n '\n \n test_expect_success TTY 'push --no-progress suppresses progress' '\n \tensure_fresh_upstream &&\n \n \ttest_terminal git push -u --no-progress upstream master >out 2>err &&\n-\t! grep \"Unpacking objects\" err &&\n-\t! grep \"Writing objects\" err\n+\ttest_i18ngrep ! \"Unpacking objects\" err &&\n+\ttest_i18ngrep ! \"Writing objects\" err\n '\n \n test_expect_success TTY 'quiet push' '\n-- \n2.7.3\n"},{"id":"288040","messageId":"1464799289-7639-24-git-send-email-vascomalmeida@sapo.pt","threadId":"42506","inReplyTo":"1464799289-7639-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v3 23/39] i18n: bisect: mark strings for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-06-01T16:41:13Z","receivedAt":"2016-06-01T16:41:13Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"In the last message, involving Q_(), try to mark the message in such way\nthat is suited for RTL (Right to Left) languages.\n\nUpdate test t6030-bisect-porcelain.sh to reflect the changes.\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n bisect.c                    | 56 +++++++++++++++++++++++++--------------------\n t/t6030-bisect-porcelain.sh | 22 +++++++++---------\n 2 files changed, 42 insertions(+), 36 deletions(-)\n\ndiff --git a/bisect.c b/bisect.c\nindex 6d93edb..a8713a8 100644\n--- a/bisect.c\n+++ b/bisect.c\n@@ -438,12 +438,12 @@ static void read_bisect_paths(struct argv_array *array)\n \tFILE *fp = fopen(filename, \"r\");\n \n \tif (!fp)\n-\t\tdie_errno(\"Could not open file '%s'\", filename);\n+\t\tdie_errno(_(\"Could not open file '%s'\"), filename);\n \n \twhile (strbuf_getline_lf(&str, fp) != EOF) {\n \t\tstrbuf_trim(&str);\n \t\tif (sq_dequote_to_argv_array(str.buf, array))\n-\t\t\tdie(\"Badly quoted content in file '%s': %s\",\n+\t\t\tdie(_(\"Badly quoted content in file '%s': %s\"),\n \t\t\t    filename, str.buf);\n \t}\n \n@@ -649,7 +649,7 @@ static void exit_if_skipped_commits(struct commit_list *tried,\n \tprint_commit_list(tried, \"%s\\n\", \"%s\\n\");\n \tif (bad)\n \t\tprintf(\"%s\\n\", oid_to_hex(bad));\n-\tprintf(\"We cannot bisect more!\\n\");\n+\tprintf(_(\"We cannot bisect more!\\n\"));\n \texit(2);\n }\n \n@@ -702,7 +702,7 @@ static struct commit *get_commit_reference(const unsigned char *sha1)\n {\n \tstruct commit *r = lookup_commit_reference(sha1);\n \tif (!r)\n-\t\tdie(\"Not a valid commit name %s\", sha1_to_hex(sha1));\n+\t\tdie(_(\"Not a valid commit name %s\"), sha1_to_hex(sha1));\n \treturn r;\n }\n \n@@ -726,27 +726,27 @@ static void handle_bad_merge_base(void)\n \t\tchar *bad_hex = oid_to_hex(current_bad_oid);\n \t\tchar *good_hex = join_sha1_array_hex(&good_revs, ' ');\n \t\tif (!strcmp(term_bad, \"bad\") && !strcmp(term_good, \"good\")) {\n-\t\t\tfprintf(stderr, \"The merge base %s is bad.\\n\"\n+\t\t\tfprintf(stderr, _(\"The merge base %s is bad.\\n\"\n \t\t\t\t\"This means the bug has been fixed \"\n-\t\t\t\t\"between %s and [%s].\\n\",\n+\t\t\t\t\"between %s and [%s].\\n\"),\n \t\t\t\tbad_hex, bad_hex, good_hex);\n \t\t} else if (!strcmp(term_bad, \"new\") && !strcmp(term_good, \"old\")) {\n-\t\t\tfprintf(stderr, \"The merge base %s is new.\\n\"\n+\t\t\tfprintf(stderr, _(\"The merge base %s is new.\\n\"\n \t\t\t\t\"The property has changed \"\n-\t\t\t\t\"between %s and [%s].\\n\",\n+\t\t\t\t\"between %s and [%s].\\n\"),\n \t\t\t\tbad_hex, bad_hex, good_hex);\n \t\t} else {\n-\t\t\tfprintf(stderr, \"The merge base %s is %s.\\n\"\n+\t\t\tfprintf(stderr, _(\"The merge base %s is %s.\\n\"\n \t\t\t\t\"This means the first '%s' commit is \"\n-\t\t\t\t\"between %s and [%s].\\n\",\n+\t\t\t\t\"between %s and [%s].\\n\"),\n \t\t\t\tbad_hex, term_bad, term_good, bad_hex, good_hex);\n \t\t}\n \t\texit(3);\n \t}\n \n-\tfprintf(stderr, \"Some %s revs are not ancestor of the %s rev.\\n\"\n+\tfprintf(stderr, _(\"Some %s revs are not ancestor of the %s rev.\\n\"\n \t\t\"git bisect cannot work properly in this case.\\n\"\n-\t\t\"Maybe you mistook %s and %s revs?\\n\",\n+\t\t\"Maybe you mistook %s and %s revs?\\n\"),\n \t\tterm_good, term_bad, term_good, term_bad);\n \texit(1);\n }\n@@ -757,11 +757,11 @@ static void handle_skipped_merge_base(const unsigned char *mb)\n \tchar *bad_hex = sha1_to_hex(current_bad_oid->hash);\n \tchar *good_hex = join_sha1_array_hex(&good_revs, ' ');\n \n-\twarning(\"the merge base between %s and [%s] \"\n+\twarning(_(\"the merge base between %s and [%s] \"\n \t\t\"must be skipped.\\n\"\n \t\t\"So we cannot be sure the first %s commit is \"\n \t\t\"between %s and %s.\\n\"\n-\t\t\"We continue anyway.\",\n+\t\t\"We continue anyway.\"),\n \t\tbad_hex, good_hex, term_bad, mb_hex, bad_hex);\n \tfree(good_hex);\n }\n@@ -792,7 +792,7 @@ static void check_merge_bases(int no_checkout)\n \t\t} else if (0 <= sha1_array_lookup(&skipped_revs, mb)) {\n \t\t\thandle_skipped_merge_base(mb);\n \t\t} else {\n-\t\t\tprintf(\"Bisecting: a merge base must be tested\\n\");\n+\t\t\tprintf(_(\"Bisecting: a merge base must be tested\\n\"));\n \t\t\texit(bisect_checkout(mb, no_checkout));\n \t\t}\n \t}\n@@ -843,7 +843,7 @@ static void check_good_are_ancestors_of_bad(const char *prefix, int no_checkout)\n \tint fd;\n \n \tif (!current_bad_oid)\n-\t\tdie(\"a %s revision is needed\", term_bad);\n+\t\tdie(_(\"a %s revision is needed\"), term_bad);\n \n \t/* Check if file BISECT_ANCESTORS_OK exists. */\n \tif (!stat(filename, &st) && S_ISREG(st.st_mode))\n@@ -860,7 +860,7 @@ static void check_good_are_ancestors_of_bad(const char *prefix, int no_checkout)\n \t/* Create file BISECT_ANCESTORS_OK. */\n \tfd = open(filename, O_CREAT | O_TRUNC | O_WRONLY, 0600);\n \tif (fd < 0)\n-\t\twarning_errno(\"could not create file '%s'\",\n+\t\twarning_errno(_(\"could not create file '%s'\"),\n \t\t\t      filename);\n \telse\n \t\tclose(fd);\n@@ -910,7 +910,7 @@ void read_bisect_terms(const char **read_bad, const char **read_good)\n \t\t\t*read_good = \"good\";\n \t\t\treturn;\n \t\t} else {\n-\t\t\tdie_errno(\"could not read file '%s'\", filename);\n+\t\t\tdie_errno(_(\"could not read file '%s'\"), filename);\n \t\t}\n \t} else {\n \t\tstrbuf_getline_lf(&str, fp);\n@@ -936,10 +936,11 @@ int bisect_next_all(const char *prefix, int no_checkout)\n \tstruct commit_list *tried;\n \tint reaches = 0, all = 0, nr, steps;\n \tconst unsigned char *bisect_rev;\n+\tchar steps_msg[32];\n \n \tread_bisect_terms(&term_bad, &term_good);\n \tif (read_bisect_refs())\n-\t\tdie(\"reading bisect refs failed\");\n+\t\tdie(_(\"reading bisect refs failed\"));\n \n \tcheck_good_are_ancestors_of_bad(prefix, no_checkout);\n \n@@ -959,7 +960,7 @@ int bisect_next_all(const char *prefix, int no_checkout)\n \t\t */\n \t\texit_if_skipped_commits(tried, NULL);\n \n-\t\tprintf(\"%s was both %s and %s\\n\",\n+\t\tprintf(_(\"%s was both %s and %s\\n\"),\n \t\t       oid_to_hex(current_bad_oid),\n \t\t       term_good,\n \t\t       term_bad);\n@@ -967,8 +968,8 @@ int bisect_next_all(const char *prefix, int no_checkout)\n \t}\n \n \tif (!all) {\n-\t\tfprintf(stderr, \"No testable commit found.\\n\"\n-\t\t\t\"Maybe you started with bad path parameters?\\n\");\n+\t\tfprintf(stderr, _(\"No testable commit found.\\n\"\n+\t\t\t\"Maybe you started with bad path parameters?\\n\"));\n \t\texit(4);\n \t}\n \n@@ -985,9 +986,14 @@ int bisect_next_all(const char *prefix, int no_checkout)\n \n \tnr = all - reaches - 1;\n \tsteps = estimate_bisect_steps(all);\n-\tprintf(\"Bisecting: %d revision%s left to test after this \"\n-\t       \"(roughly %d step%s)\\n\", nr, (nr == 1 ? \"\" : \"s\"),\n-\t       steps, (steps == 1 ? \"\" : \"s\"));\n+\txsnprintf(steps_msg, sizeof(steps_msg),\n+\t\t  Q_(\"(roughly %d step)\", \"(roughly %d steps)\", steps),\n+\t\t  steps);\n+\t/* TRANSLATORS: the last %s will be replaced with\n+\t   \"(roughly %d steps)\" translation */\n+\tprintf(Q_(\"Bisecting: %d revision left to test after this %s\\n\",\n+\t\t  \"Bisecting: %d revisions left to test after this %s\\n\",\n+\t\t  nr), nr, steps_msg);\n \n \treturn bisect_checkout(bisect_rev, no_checkout);\n }\ndiff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh\nindex 7012011..86d1380 100755\n--- a/t/t6030-bisect-porcelain.sh\n+++ b/t/t6030-bisect-porcelain.sh\n@@ -362,7 +362,7 @@ test_expect_success 'bisect starting with a detached HEAD' '\n test_expect_success 'bisect errors out if bad and good are mistaken' '\n \tgit bisect reset &&\n \ttest_must_fail git bisect start $HASH2 $HASH4 2> rev_list_error &&\n-\tgrep \"mistook good and bad\" rev_list_error &&\n+\ttest_i18ngrep \"mistook good and bad\" rev_list_error &&\n \tgit bisect reset\n '\n \n@@ -404,7 +404,7 @@ test_expect_success 'side branch creation' '\n \n test_expect_success 'good merge base when good and bad are siblings' '\n \tgit bisect start \"$HASH7\" \"$SIDE_HASH7\" > my_bisect_log.txt &&\n-\tgrep \"merge base must be tested\" my_bisect_log.txt &&\n+\ttest_i18ngrep \"merge base must be tested\" my_bisect_log.txt &&\n \tgrep $HASH4 my_bisect_log.txt &&\n \tgit bisect good > my_bisect_log.txt &&\n \ttest_must_fail grep \"merge base must be tested\" my_bisect_log.txt &&\n@@ -413,7 +413,7 @@ test_expect_success 'good merge base when good and bad are siblings' '\n '\n test_expect_success 'skipped merge base when good and bad are siblings' '\n \tgit bisect start \"$SIDE_HASH7\" \"$HASH7\" > my_bisect_log.txt &&\n-\tgrep \"merge base must be tested\" my_bisect_log.txt &&\n+\ttest_i18ngrep \"merge base must be tested\" my_bisect_log.txt &&\n \tgrep $HASH4 my_bisect_log.txt &&\n \tgit bisect skip > my_bisect_log.txt 2>&1 &&\n \tgrep \"warning\" my_bisect_log.txt &&\n@@ -423,11 +423,11 @@ test_expect_success 'skipped merge base when good and bad are siblings' '\n \n test_expect_success 'bad merge base when good and bad are siblings' '\n \tgit bisect start \"$HASH7\" HEAD > my_bisect_log.txt &&\n-\tgrep \"merge base must be tested\" my_bisect_log.txt &&\n+\ttest_i18ngrep \"merge base must be tested\" my_bisect_log.txt &&\n \tgrep $HASH4 my_bisect_log.txt &&\n \ttest_must_fail git bisect bad > my_bisect_log.txt 2>&1 &&\n-\tgrep \"merge base $HASH4 is bad\" my_bisect_log.txt &&\n-\tgrep \"fixed between $HASH4 and \\[$SIDE_HASH7\\]\" my_bisect_log.txt &&\n+\ttest_i18ngrep \"merge base $HASH4 is bad\" my_bisect_log.txt &&\n+\ttest_i18ngrep \"fixed between $HASH4 and \\[$SIDE_HASH7\\]\" my_bisect_log.txt &&\n \tgit bisect reset\n '\n \n@@ -460,9 +460,9 @@ test_expect_success 'many merge bases creation' '\n \n test_expect_success 'good merge bases when good and bad are siblings' '\n \tgit bisect start \"$B_HASH\" \"$A_HASH\" > my_bisect_log.txt &&\n-\tgrep \"merge base must be tested\" my_bisect_log.txt &&\n+\ttest_i18ngrep \"merge base must be tested\" my_bisect_log.txt &&\n \tgit bisect good > my_bisect_log2.txt &&\n-\tgrep \"merge base must be tested\" my_bisect_log2.txt &&\n+\ttest_i18ngrep \"merge base must be tested\" my_bisect_log2.txt &&\n \t{\n \t\t{\n \t\t\tgrep \"$SIDE_HASH5\" my_bisect_log.txt &&\n@@ -477,14 +477,14 @@ test_expect_success 'good merge bases when good and bad are siblings' '\n \n test_expect_success 'optimized merge base checks' '\n \tgit bisect start \"$HASH7\" \"$SIDE_HASH7\" > my_bisect_log.txt &&\n-\tgrep \"merge base must be tested\" my_bisect_log.txt &&\n+\ttest_i18ngrep \"merge base must be tested\" my_bisect_log.txt &&\n \tgrep \"$HASH4\" my_bisect_log.txt &&\n \tgit bisect good > my_bisect_log2.txt &&\n \ttest -f \".git/BISECT_ANCESTORS_OK\" &&\n \ttest \"$HASH6\" = $(git rev-parse --verify HEAD) &&\n \tgit bisect bad > my_bisect_log3.txt &&\n \tgit bisect good \"$A_HASH\" > my_bisect_log4.txt &&\n-\tgrep \"merge base must be tested\" my_bisect_log4.txt &&\n+\ttest_i18ngrep \"merge base must be tested\" my_bisect_log4.txt &&\n \ttest_must_fail test -f \".git/BISECT_ANCESTORS_OK\"\n '\n \n@@ -562,7 +562,7 @@ test_expect_success 'skipping away from skipped commit' '\n \n test_expect_success 'erroring out when using bad path parameters' '\n \ttest_must_fail git bisect start $PARA_HASH7 $HASH1 -- foobar 2> error.txt &&\n-\tgrep \"bad path parameters\" error.txt\n+\ttest_i18ngrep \"bad path parameters\" error.txt\n '\n \n test_expect_success 'test bisection on bare repo - --no-checkout specified' '\n-- \n2.7.3\n"},{"id":"288050","messageId":"1464799289-7639-25-git-send-email-vascomalmeida@sapo.pt","threadId":"42506","inReplyTo":"1464799289-7639-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v3 24/39] i18n: bisect: enable l10n of bisect terms in messages","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-06-01T16:41:14Z","receivedAt":"2016-06-01T16:41:14Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Enable localization (l10n) of bisect terms in messages for the user.\n\nUse an array to explicitly list and mark bisect terms for translation\nusing the no-op N_(). Additionally, this catches at compile time errors\nsuch as wrongly writing the bisect terms, e.g., writing \"god\" instead of\n\"good\", since now we would use term_names[GOOD] syntax.\n\nTriggering the retrieval of the term translation is done at runtime\nwith _(term_bad) and  _(term_good).\n\nThere are 2 messages that can't be marked for translation at this point,\nbecause they're grep'ed by bisect_run function in git-bisect.sh.\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n bisect.c | 29 +++++++++++++++++++----------\n 1 file changed, 19 insertions(+), 10 deletions(-)\n\ndiff --git a/bisect.c b/bisect.c\nindex a8713a8..293d7ec 100644\n--- a/bisect.c\n+++ b/bisect.c\n@@ -23,6 +23,15 @@ static const char *argv_show_branch[] = {\"show-branch\", NULL, NULL};\n static const char *term_bad;\n static const char *term_good;\n \n+enum term { BAD, GOOD, OLD, NEW };\n+static const char *term_names[] = {\n+/* TRANSLATORS: in bisect.c source code file, the following terms are\n+   used to describe a \"bad commit\", \"good commit\", \"new revision\", etc.\n+   Please, if you can, check the source when you are not sure if a %s\n+   would be replaced by one of the following terms. */\n+\tN_(\"bad\"), N_(\"good\"), N_(\"old\"), N_(\"new\"),  NULL\n+};\n+\n /* Remember to update object flag allocation in object.h */\n #define COUNTED\t\t(1u<<16)\n \n@@ -725,12 +734,12 @@ static void handle_bad_merge_base(void)\n \tif (is_expected_rev(current_bad_oid)) {\n \t\tchar *bad_hex = oid_to_hex(current_bad_oid);\n \t\tchar *good_hex = join_sha1_array_hex(&good_revs, ' ');\n-\t\tif (!strcmp(term_bad, \"bad\") && !strcmp(term_good, \"good\")) {\n+\t\tif (!strcmp(term_bad, term_names[BAD]) && !strcmp(term_good, term_names[GOOD])) {\n \t\t\tfprintf(stderr, _(\"The merge base %s is bad.\\n\"\n \t\t\t\t\"This means the bug has been fixed \"\n \t\t\t\t\"between %s and [%s].\\n\"),\n \t\t\t\tbad_hex, bad_hex, good_hex);\n-\t\t} else if (!strcmp(term_bad, \"new\") && !strcmp(term_good, \"old\")) {\n+\t\t} else if (!strcmp(term_bad, term_names[NEW]) && !strcmp(term_good, term_names[OLD])) {\n \t\t\tfprintf(stderr, _(\"The merge base %s is new.\\n\"\n \t\t\t\t\"The property has changed \"\n \t\t\t\t\"between %s and [%s].\\n\"),\n@@ -739,7 +748,7 @@ static void handle_bad_merge_base(void)\n \t\t\tfprintf(stderr, _(\"The merge base %s is %s.\\n\"\n \t\t\t\t\"This means the first '%s' commit is \"\n \t\t\t\t\"between %s and [%s].\\n\"),\n-\t\t\t\tbad_hex, term_bad, term_good, bad_hex, good_hex);\n+\t\t\t\tbad_hex, _(term_bad), _(term_good), bad_hex, good_hex);\n \t\t}\n \t\texit(3);\n \t}\n@@ -747,7 +756,7 @@ static void handle_bad_merge_base(void)\n \tfprintf(stderr, _(\"Some %s revs are not ancestor of the %s rev.\\n\"\n \t\t\"git bisect cannot work properly in this case.\\n\"\n \t\t\"Maybe you mistook %s and %s revs?\\n\"),\n-\t\tterm_good, term_bad, term_good, term_bad);\n+\t\t_(term_good), _(term_bad), _(term_good), _(term_bad));\n \texit(1);\n }\n \n@@ -762,7 +771,7 @@ static void handle_skipped_merge_base(const unsigned char *mb)\n \t\t\"So we cannot be sure the first %s commit is \"\n \t\t\"between %s and %s.\\n\"\n \t\t\"We continue anyway.\"),\n-\t\tbad_hex, good_hex, term_bad, mb_hex, bad_hex);\n+\t\tbad_hex, good_hex, _(term_bad), mb_hex, bad_hex);\n \tfree(good_hex);\n }\n \n@@ -843,7 +852,7 @@ static void check_good_are_ancestors_of_bad(const char *prefix, int no_checkout)\n \tint fd;\n \n \tif (!current_bad_oid)\n-\t\tdie(_(\"a %s revision is needed\"), term_bad);\n+\t\tdie(_(\"a %s revision is needed\"), _(term_bad));\n \n \t/* Check if file BISECT_ANCESTORS_OK exists. */\n \tif (!stat(filename, &st) && S_ISREG(st.st_mode))\n@@ -906,8 +915,8 @@ void read_bisect_terms(const char **read_bad, const char **read_good)\n \n \tif (!fp) {\n \t\tif (errno == ENOENT) {\n-\t\t\t*read_bad = \"bad\";\n-\t\t\t*read_good = \"good\";\n+\t\t\t*read_bad = term_names[BAD];\n+\t\t\t*read_good = term_names[GOOD];\n \t\t\treturn;\n \t\t} else {\n \t\t\tdie_errno(_(\"could not read file '%s'\"), filename);\n@@ -962,8 +971,8 @@ int bisect_next_all(const char *prefix, int no_checkout)\n \n \t\tprintf(_(\"%s was both %s and %s\\n\"),\n \t\t       oid_to_hex(current_bad_oid),\n-\t\t       term_good,\n-\t\t       term_bad);\n+\t\t       _(term_good),\n+\t\t       _(term_bad));\n \t\texit(1);\n \t}\n \n-- \n2.7.3\n"},{"id":"288046","messageId":"1464799289-7639-26-git-send-email-vascomalmeida@sapo.pt","threadId":"42506","inReplyTo":"1464799289-7639-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v3 25/39] i18n: transport-helper.c: change N_() call to _()","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-06-01T16:41:15Z","receivedAt":"2016-06-01T16:41:15Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"The N_() no-op call currently marks the string to be extracted by\nxgettext but doesn't trigger the retrieval of the translation at run\ntime, whereas _() does both. Meaning that, in spite of having\ntranslations available, they were never retrieved to make use of them.\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n transport-helper.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/transport-helper.c b/transport-helper.c\nindex bd666b2..4208743 100644\n--- a/transport-helper.c\n+++ b/transport-helper.c\n@@ -1038,7 +1038,7 @@ static struct ref *get_refs_list(struct transport *transport, int for_push)\n \t\t\t\t(*tail)->status |= REF_STATUS_UPTODATE;\n \t\t\t\tif (read_ref((*tail)->name,\n \t\t\t\t\t     (*tail)->old_oid.hash) < 0)\n-\t\t\t\t\tdie(N_(\"Could not read ref %s\"),\n+\t\t\t\t\tdie(_(\"Could not read ref %s\"),\n \t\t\t\t\t    (*tail)->name);\n \t\t\t}\n \t\t}\n-- \n2.7.3\n"},{"id":"288048","messageId":"1464799289-7639-27-git-send-email-vascomalmeida@sapo.pt","threadId":"42506","inReplyTo":"1464799289-7639-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v3 26/39] i18n: notes: mark strings for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-06-01T16:41:16Z","receivedAt":"2016-06-01T16:41:16Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Mark strings of messages for the user as translatable.\n\nUpdate tests t3310-notes-merge-manual-resolve.sh and\nt3320-notes-merge-worktrees.sh to reflect new translatable messages.\n\nTests that grep for .git/NOTES_MERGE_WORKTREE reflect the translatable\nstring \"Automatic notes merge failed. Fix conflicts in %s and [...]\".\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n builtin/notes.c                       | 20 ++++++++++----------\n t/t3310-notes-merge-manual-resolve.sh |  8 ++++----\n t/t3320-notes-merge-worktrees.sh      |  2 +-\n 3 files changed, 15 insertions(+), 15 deletions(-)\n\ndiff --git a/builtin/notes.c b/builtin/notes.c\nindex c65b59a..d11e6eb 100644\n--- a/builtin/notes.c\n+++ b/builtin/notes.c\n@@ -749,7 +749,7 @@ static int git_config_get_notes_strategy(const char *key,\n \tif (git_config_get_string(key, &value))\n \t\treturn 1;\n \tif (parse_notes_merge_strategy(value, strategy))\n-\t\tgit_die_config(key, \"unknown notes merge strategy %s\", value);\n+\t\tgit_die_config(key, _(\"unknown notes merge strategy %s\"), value);\n \n \tfree(value);\n \treturn 0;\n@@ -788,15 +788,15 @@ static int merge(int argc, const char **argv, const char *prefix)\n \tif (strategy || do_commit + do_abort == 0)\n \t\tdo_merge = 1;\n \tif (do_merge + do_commit + do_abort != 1) {\n-\t\terror(\"cannot mix --commit, --abort or -s/--strategy\");\n+\t\terror(_(\"cannot mix --commit, --abort or -s/--strategy\"));\n \t\tusage_with_options(git_notes_merge_usage, options);\n \t}\n \n \tif (do_merge && argc != 1) {\n-\t\terror(\"Must specify a notes ref to merge\");\n+\t\terror(_(\"Must specify a notes ref to merge\"));\n \t\tusage_with_options(git_notes_merge_usage, options);\n \t} else if (!do_merge && argc) {\n-\t\terror(\"too many parameters\");\n+\t\terror(_(\"too many parameters\"));\n \t\tusage_with_options(git_notes_merge_usage, options);\n \t}\n \n@@ -817,7 +817,7 @@ static int merge(int argc, const char **argv, const char *prefix)\n \n \tif (strategy) {\n \t\tif (parse_notes_merge_strategy(strategy, &o.strategy)) {\n-\t\t\terror(\"Unknown -s/--strategy: %s\", strategy);\n+\t\t\terror(_(\"Unknown -s/--strategy: %s\"), strategy);\n \t\t\tusage_with_options(git_notes_merge_usage, options);\n \t\t}\n \t} else {\n@@ -857,11 +857,11 @@ static int merge(int argc, const char **argv, const char *prefix)\n \t\t\tdie(_(\"A notes merge into %s is already in-progress at %s\"),\n \t\t\t    default_notes_ref(), wt->path);\n \t\tif (create_symref(\"NOTES_MERGE_REF\", default_notes_ref(), NULL))\n-\t\t\tdie(\"Failed to store link to current notes ref (%s)\",\n+\t\t\tdie(_(\"Failed to store link to current notes ref (%s)\"),\n \t\t\t    default_notes_ref());\n-\t\tprintf(\"Automatic notes merge failed. Fix conflicts in %s and \"\n-\t\t       \"commit the result with 'git notes merge --commit', or \"\n-\t\t       \"abort the merge with 'git notes merge --abort'.\\n\",\n+\t\tprintf(_(\"Automatic notes merge failed. Fix conflicts in %s and \"\n+\t\t\t \"commit the result with 'git notes merge --commit', or \"\n+\t\t\t \"abort the merge with 'git notes merge --abort'.\\n\"),\n \t\t       git_path(NOTES_MERGE_WORKTREE));\n \t}\n \n@@ -964,7 +964,7 @@ static int get_ref(int argc, const char **argv, const char *prefix)\n \t\t\t     git_notes_get_ref_usage, 0);\n \n \tif (argc) {\n-\t\terror(\"too many parameters\");\n+\t\terror(_(\"too many parameters\"));\n \t\tusage_with_options(git_notes_get_ref_usage, options);\n \t}\n \ndiff --git a/t/t3310-notes-merge-manual-resolve.sh b/t/t3310-notes-merge-manual-resolve.sh\nindex d557212..6967436 100755\n--- a/t/t3310-notes-merge-manual-resolve.sh\n+++ b/t/t3310-notes-merge-manual-resolve.sh\n@@ -178,7 +178,7 @@ test_expect_success 'merge z into m (== y) with default (\"manual\") resolver => C\n \tgit config core.notesRef refs/notes/m &&\n \ttest_must_fail git notes merge z >output &&\n \t# Output should point to where to resolve conflicts\n-\tgrep -q \"\\\\.git/NOTES_MERGE_WORKTREE\" output &&\n+\ttest_i18ngrep \"\\\\.git/NOTES_MERGE_WORKTREE\" output &&\n \t# Inspect merge conflicts\n \tls .git/NOTES_MERGE_WORKTREE >output_conflicts &&\n \ttest_cmp expect_conflicts output_conflicts &&\n@@ -381,7 +381,7 @@ test_expect_success 'redo merge of z into m (== y) with default (\"manual\") resol\n \tgit config core.notesRef refs/notes/m &&\n \ttest_must_fail git notes merge z >output &&\n \t# Output should point to where to resolve conflicts\n-\tgrep -q \"\\\\.git/NOTES_MERGE_WORKTREE\" output &&\n+\ttest_i18ngrep \"\\\\.git/NOTES_MERGE_WORKTREE\" output &&\n \t# Inspect merge conflicts\n \tls .git/NOTES_MERGE_WORKTREE >output_conflicts &&\n \ttest_cmp expect_conflicts output_conflicts &&\n@@ -415,7 +415,7 @@ git rev-parse refs/notes/z > pre_merge_z\n test_expect_success 'redo merge of z into m (== y) with default (\"manual\") resolver => Conflicting 3-way merge' '\n \ttest_must_fail git notes merge z >output &&\n \t# Output should point to where to resolve conflicts\n-\tgrep -q \"\\\\.git/NOTES_MERGE_WORKTREE\" output &&\n+\ttest_i18ngrep \"\\\\.git/NOTES_MERGE_WORKTREE\" output &&\n \t# Inspect merge conflicts\n \tls .git/NOTES_MERGE_WORKTREE >output_conflicts &&\n \ttest_cmp expect_conflicts output_conflicts &&\n@@ -496,7 +496,7 @@ test_expect_success 'redo merge of z into m (== y) with default (\"manual\") resol\n \tgit update-ref refs/notes/m refs/notes/y &&\n \ttest_must_fail git notes merge z >output &&\n \t# Output should point to where to resolve conflicts\n-\tgrep -q \"\\\\.git/NOTES_MERGE_WORKTREE\" output &&\n+\ttest_i18ngrep \"\\\\.git/NOTES_MERGE_WORKTREE\" output &&\n \t# Inspect merge conflicts\n \tls .git/NOTES_MERGE_WORKTREE >output_conflicts &&\n \ttest_cmp expect_conflicts output_conflicts &&\ndiff --git a/t/t3320-notes-merge-worktrees.sh b/t/t3320-notes-merge-worktrees.sh\nindex 522157b..6e05115 100755\n--- a/t/t3320-notes-merge-worktrees.sh\n+++ b/t/t3320-notes-merge-worktrees.sh\n@@ -62,7 +62,7 @@ test_expect_success 'merge z into x while mid-merge on y succeeds' '\n \t\tcd worktree2 &&\n \t\tgit config core.notesRef refs/notes/x &&\n \t\ttest_must_fail git notes merge z 2>&1 >out &&\n-\t\tgrep \"Automatic notes merge failed\" out &&\n+\t\ttest_i18ngrep \"Automatic notes merge failed\" out &&\n \t\tgrep -v \"A notes merge into refs/notes/x is already in-progress in\" out\n \t) &&\n \techo \"ref: refs/notes/x\" >expect &&\n-- \n2.7.3\n"},{"id":"288049","messageId":"1464799289-7639-28-git-send-email-vascomalmeida@sapo.pt","threadId":"42506","inReplyTo":"1464799289-7639-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v3 27/39] i18n: notes: mark options for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-06-01T16:41:17Z","receivedAt":"2016-06-01T16:41:17Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Mark options description of git prune for translation.\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n builtin/notes.c | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin/notes.c b/builtin/notes.c\nindex d11e6eb..0572051 100644\n--- a/builtin/notes.c\n+++ b/builtin/notes.c\n@@ -934,8 +934,8 @@ static int prune(int argc, const char **argv, const char *prefix)\n \tstruct notes_tree *t;\n \tint show_only = 0, verbose = 0;\n \tstruct option options[] = {\n-\t\tOPT__DRY_RUN(&show_only, \"do not remove, show only\"),\n-\t\tOPT__VERBOSE(&verbose, \"report pruned notes\"),\n+\t\tOPT__DRY_RUN(&show_only, N_(\"do not remove, show only\")),\n+\t\tOPT__VERBOSE(&verbose, N_(\"report pruned notes\")),\n \t\tOPT_END()\n \t};\n \n-- \n2.7.3\n"},{"id":"288043","messageId":"1464799289-7639-29-git-send-email-vascomalmeida@sapo.pt","threadId":"42506","inReplyTo":"1464799289-7639-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v3 28/39] i18n: config: unfold error messages marked for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-06-01T16:41:18Z","receivedAt":"2016-06-01T16:41:18Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Introduced in 473166b (\"config: add 'origin_type' to config_source\nstruct\", 2016-02-19), Git can inform the user about the origin of a\nconfig error, but the implementation does not allow translators to\ntranslate the keywords 'file', 'blob, 'standard input', and\n'submodule-blob'. Moreover, for the second message, a reason for the\nerror is appended to the message, not allowing translators to translate\nthat reason either.\n\nUnfold the message into several templates for each known origin_type.\nThat would result in better translation at the expense of code\nverbosity.\n\nAdd enum git_config_oringin_type to ease management of the various\nconfiguration origin types (blob, file, etc).\n\nFor the first instance, use xsnprintf function to prepare the message\nstring, instead of doing something like it's done for the second one,\nbecause intelligibility and code conciseness are improved for that\ninstance.\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n cache.h            |   9 ++++-\n config.c           | 102 ++++++++++++++++++++++++++++++++++++++++++++---------\n submodule-config.c |   2 +-\n 3 files changed, 95 insertions(+), 18 deletions(-)\n\ndiff --git a/cache.h b/cache.h\nindex 6049f86..4bded9a 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -1559,10 +1559,17 @@ struct git_config_source {\n \tconst char *blob;\n };\n \n+enum git_config_origin_type {\n+\tCFG_BLOB,\n+\tCFG_FILE,\n+\tCFG_STDIN,\n+\tCFG_SUBMODULE_BLOB\n+};\n+\n typedef int (*config_fn_t)(const char *, const char *, void *);\n extern int git_default_config(const char *, const char *, void *);\n extern int git_config_from_file(config_fn_t fn, const char *, void *);\n-extern int git_config_from_mem(config_fn_t fn, const char *origin_type,\n+extern int git_config_from_mem(config_fn_t fn, const enum git_config_origin_type,\n \t\t\t\t\tconst char *name, const char *buf, size_t len, void *data);\n extern void git_config_push_parameter(const char *text);\n extern int git_config_from_parameters(config_fn_t fn, void *data);\ndiff --git a/config.c b/config.c\nindex f51c56b..b08a418 100644\n--- a/config.c\n+++ b/config.c\n@@ -24,7 +24,7 @@ struct config_source {\n \t\t\tsize_t pos;\n \t\t} buf;\n \t} u;\n-\tconst char *origin_type;\n+\tenum git_config_origin_type origin_type;\n \tconst char *name;\n \tconst char *path;\n \tint die_on_error;\n@@ -417,6 +417,7 @@ static int git_parse_source(config_fn_t fn, void *data)\n \tint comment = 0;\n \tint baselen = 0;\n \tstruct strbuf *var = &cf->var;\n+\tchar error_msg[128];\n \n \t/* U+FEFF Byte Order Mark in UTF8 */\n \tconst char *bomptr = utf8_bom;\n@@ -471,10 +472,38 @@ static int git_parse_source(config_fn_t fn, void *data)\n \t\tif (get_value(fn, data, var) < 0)\n \t\t\tbreak;\n \t}\n+\n+\tswitch (cf->origin_type) {\n+\tcase CFG_BLOB:\n+\t\txsnprintf(error_msg, sizeof(error_msg),\n+\t\t\t  _(\"bad config line %d in blob %s\"),\n+\t\t\t  cf->linenr, cf->name);\n+\t\tbreak;\n+\tcase CFG_FILE:\n+\t\txsnprintf(error_msg, sizeof(error_msg),\n+\t\t\t  _(\"bad config line %d in file %s\"),\n+\t\t\t  cf->linenr, cf->name);\n+\t\tbreak;\n+\tcase CFG_STDIN:\n+\t\txsnprintf(error_msg, sizeof(error_msg),\n+\t\t\t  _(\"bad config line %d in standard input\"),\n+\t\t\t  cf->linenr);\n+\t\tbreak;\n+\tcase CFG_SUBMODULE_BLOB:\n+\t\txsnprintf(error_msg, sizeof(error_msg),\n+\t\t\t  _(\"bad config line %d in submodule-blob %s\"),\n+\t\t\t  cf->linenr, cf->name);\n+\t\tbreak;\n+\tdefault:\n+\t\txsnprintf(error_msg, sizeof(error_msg),\n+\t\t\t  _(\"bad config line %d in %s\"),\n+\t\t\t  cf->linenr, cf->name);\n+\t}\n+\n \tif (cf->die_on_error)\n-\t\tdie(_(\"bad config line %d in %s %s\"), cf->linenr, cf->origin_type, cf->name);\n+\t\tdie(error_msg);\n \telse\n-\t\treturn error(_(\"bad config line %d in %s %s\"), cf->linenr, cf->origin_type, cf->name);\n+\t\treturn error(error_msg);\n }\n \n static int parse_unit_factor(const char *end, uintmax_t *val)\n@@ -583,16 +612,42 @@ int git_parse_ulong(const char *value, unsigned long *ret)\n NORETURN\n static void die_bad_number(const char *name, const char *value)\n {\n-\tconst char *reason = errno == ERANGE ?\n-\t\t\t     \"out of range\" :\n-\t\t\t     \"invalid unit\";\n \tif (!value)\n \t\tvalue = \"\";\n \n-\tif (cf && cf->origin_type && cf->name)\n-\t\tdie(_(\"bad numeric config value '%s' for '%s' in %s %s: %s\"),\n-\t\t    value, name, cf->origin_type, cf->name, reason);\n-\tdie(_(\"bad numeric config value '%s' for '%s': %s\"), value, name, reason);\n+\tif (!(cf && cf->name))\n+\t\tdie(errno == ERANGE\n+\t\t    ? _(\"bad numeric config value '%s' for '%s': out of range\")\n+\t\t    : _(\"bad numeric config value '%s' for '%s': invalid unit\"),\n+\t\t    value, name);\n+\n+\tswitch (cf->origin_type) {\n+\tcase CFG_BLOB:\n+\t\tdie(errno == ERANGE\n+\t\t    ? _(\"bad numeric config value '%s' for '%s' in blob %s: out of range\")\n+\t\t    : _(\"bad numeric config value '%s' for '%s' in blob %s: invalid unit\"),\n+\t\t    value, name, cf->name);\n+\tcase CFG_FILE:\n+\t\tdie(errno == ERANGE\n+\t\t    ? _(\"bad numeric config value '%s' for '%s' in file %s: out of range\")\n+\t\t    : _(\"bad numeric config value '%s' for '%s' in file %s: invalid unit\"),\n+\t\t    value, name, cf->name);\n+\tcase CFG_STDIN:\n+\t\tdie(errno == ERANGE\n+\t\t    ? _(\"bad numeric config value '%s' for '%s' in standard input: out of range\")\n+\t\t    : _(\"bad numeric config value '%s' for '%s' in standard input: invalid unit\"),\n+\t\t    value, name);\n+\tcase CFG_SUBMODULE_BLOB:\n+\t\tdie(errno == ERANGE\n+\t\t    ? _(\"bad numeric config value '%s' for '%s' in submodule-blob %s: out of range\")\n+\t\t    : _(\"bad numeric config value '%s' for '%s' in submodule-blob %s: invalid unit\"),\n+\t\t    value, name, cf->name);\n+\tdefault:\n+\t\tdie(errno == ERANGE\n+\t\t    ? _(\"bad numeric config value '%s' for '%s' in %s: out of range\")\n+\t\t    : _(\"bad numeric config value '%s' for '%s' in %s: invalid unit\"),\n+\t\t    value, name, cf->name);\n+\t}\n }\n \n int git_config_int(const char *name, const char *value)\n@@ -1069,7 +1124,8 @@ static int do_config_from(struct config_source *top, config_fn_t fn, void *data)\n }\n \n static int do_config_from_file(config_fn_t fn,\n-\t\tconst char *origin_type, const char *name, const char *path, FILE *f,\n+\t\tconst enum git_config_origin_type origin_type,\n+\t\tconst char *name, const char *path, FILE *f,\n \t\tvoid *data)\n {\n \tstruct config_source top;\n@@ -1088,7 +1144,7 @@ static int do_config_from_file(config_fn_t fn,\n \n static int git_config_from_stdin(config_fn_t fn, void *data)\n {\n-\treturn do_config_from_file(fn, \"standard input\", \"\", NULL, stdin, data);\n+\treturn do_config_from_file(fn, CFG_STDIN, \"\", NULL, stdin, data);\n }\n \n int git_config_from_file(config_fn_t fn, const char *filename, void *data)\n@@ -1099,14 +1155,14 @@ int git_config_from_file(config_fn_t fn, const char *filename, void *data)\n \tf = fopen(filename, \"r\");\n \tif (f) {\n \t\tflockfile(f);\n-\t\tret = do_config_from_file(fn, \"file\", filename, filename, f, data);\n+\t\tret = do_config_from_file(fn, CFG_FILE, filename, filename, f, data);\n \t\tfunlockfile(f);\n \t\tfclose(f);\n \t}\n \treturn ret;\n }\n \n-int git_config_from_mem(config_fn_t fn, const char *origin_type,\n+int git_config_from_mem(config_fn_t fn, const enum git_config_origin_type origin_type,\n \t\t\tconst char *name, const char *buf, size_t len, void *data)\n {\n \tstruct config_source top;\n@@ -1143,7 +1199,7 @@ static int git_config_from_blob_sha1(config_fn_t fn,\n \t\treturn error(\"reference '%s' does not point to a blob\", name);\n \t}\n \n-\tret = git_config_from_mem(fn, \"blob\", name, buf, size, data);\n+\tret = git_config_from_mem(fn, CFG_BLOB, name, buf, size, data);\n \tfree(buf);\n \n \treturn ret;\n@@ -2442,7 +2498,21 @@ int parse_config_key(const char *var,\n \n const char *current_config_origin_type(void)\n {\n-\treturn cf && cf->origin_type ? cf->origin_type : \"command line\";\n+\tif (!cf)\n+\t\treturn \"command line\";\n+\n+\tswitch (cf->origin_type) {\n+\tcase CFG_BLOB:\n+\t\treturn \"blob\";\n+\tcase CFG_FILE:\n+\t\treturn \"file\";\n+\tcase CFG_STDIN:\n+\t\treturn \"standard input\";\n+\tcase CFG_SUBMODULE_BLOB:\n+\t\treturn \"submodule-blob\";\n+\tdefault:\n+\t\treturn \"command line\";\n+\t}\n }\n \n const char *current_config_name(void)\ndiff --git a/submodule-config.c b/submodule-config.c\nindex debab29..f53f6bd 100644\n--- a/submodule-config.c\n+++ b/submodule-config.c\n@@ -439,7 +439,7 @@ static const struct submodule *config_from(struct submodule_cache *cache,\n \tparameter.commit_sha1 = commit_sha1;\n \tparameter.gitmodules_sha1 = sha1;\n \tparameter.overwrite = 0;\n-\tgit_config_from_mem(parse_config, \"submodule-blob\", rev.buf,\n+\tgit_config_from_mem(parse_config, CFG_SUBMODULE_BLOB, rev.buf,\n \t\t\tconfig, config_size, &parameter);\n \tfree(config);\n \n-- \n2.7.3\n"},{"id":"288051","messageId":"1464799289-7639-30-git-send-email-vascomalmeida@sapo.pt","threadId":"42506","inReplyTo":"1464799289-7639-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v3 29/39] i18n: merge: mark messages for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-06-01T16:41:19Z","receivedAt":"2016-06-01T16:41:19Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Mark messages shown to the user for translation.\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n builtin/merge.c | 10 +++++-----\n 1 file changed, 5 insertions(+), 5 deletions(-)\n\ndiff --git a/builtin/merge.c b/builtin/merge.c\nindex b555a1b..961def5 100644\n--- a/builtin/merge.c\n+++ b/builtin/merge.c\n@@ -1014,7 +1014,7 @@ static int default_edit_option(void)\n \tif (e) {\n \t\tint v = git_config_maybe_bool(name, e);\n \t\tif (v < 0)\n-\t\t\tdie(\"Bad value '%s' in environment '%s'\", e, name);\n+\t\t\tdie(_(\"Bad value '%s' in environment '%s'\"), e, name);\n \t\treturn v;\n \t}\n \n@@ -1115,7 +1115,7 @@ static void handle_fetch_head(struct commit_list **remotes, struct strbuf *merge\n \t\tif (!commit) {\n \t\t\tif (ptr)\n \t\t\t\t*ptr = '\\0';\n-\t\t\tdie(\"not something we can merge in %s: %s\",\n+\t\t\tdie(_(\"not something we can merge in %s: %s\"),\n \t\t\t    filename, merge_names->buf + pos);\n \t\t}\n \t\tremotes = &commit_list_insert(commit, remotes)->next;\n@@ -1149,7 +1149,7 @@ static struct commit_list *collect_parents(struct commit *head_commit,\n \t\t\tstruct commit *commit = get_merge_parent(argv[i]);\n \t\t\tif (!commit)\n \t\t\t\thelp_unknown_ref(argv[i], \"merge\",\n-\t\t\t\t\t\t \"not something we can merge\");\n+\t\t\t\t\t\t _(\"not something we can merge\"));\n \t\t\tremotes = &commit_list_insert(commit, remotes)->next;\n \t\t}\n \t\tremoteheads = reduce_parents(head_commit, head_subsumed, remoteheads);\n@@ -1421,7 +1421,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)\n \t\t * If head can reach all the merge then we are up to date.\n \t\t * but first the most common case of merging one remote.\n \t\t */\n-\t\tfinish_up_to_date(\"Already up-to-date.\");\n+\t\tfinish_up_to_date(_(\"Already up-to-date.\"));\n \t\tgoto done;\n \t} else if (fast_forward != FF_NO && !remoteheads->next &&\n \t\t\t!common->next &&\n@@ -1506,7 +1506,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)\n \t\t\t}\n \t\t}\n \t\tif (up_to_date) {\n-\t\t\tfinish_up_to_date(\"Already up-to-date. Yeeah!\");\n+\t\t\tfinish_up_to_date(_(\"Already up-to-date. Yeeah!\"));\n \t\t\tgoto done;\n \t\t}\n \t}\n-- \n2.7.3\n"},{"id":"288044","messageId":"1464799289-7639-31-git-send-email-vascomalmeida@sapo.pt","threadId":"42506","inReplyTo":"1464799289-7639-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v3 30/39] i18n: merge: change command option help to lowercase","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-06-01T16:41:20Z","receivedAt":"2016-06-01T16:41:20Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Change command option description to lowercase, matching pull\ncounterpart option. Translators would have to translate such message\nonly once.\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n builtin/merge.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/builtin/merge.c b/builtin/merge.c\nindex 961def5..d82f6c1 100644\n--- a/builtin/merge.c\n+++ b/builtin/merge.c\n@@ -211,7 +211,7 @@ static struct option builtin_merge_options[] = {\n \t\tPARSE_OPT_NOARG | PARSE_OPT_NONEG, NULL, FF_ONLY },\n \tOPT_RERERE_AUTOUPDATE(&allow_rerere_auto),\n \tOPT_BOOL(0, \"verify-signatures\", &verify_signatures,\n-\t\tN_(\"Verify that the named commit has a valid GPG signature\")),\n+\t\tN_(\"verify that the named commit has a valid GPG signature\")),\n \tOPT_CALLBACK('s', \"strategy\", &use_strategies, N_(\"strategy\"),\n \t\tN_(\"merge strategy to use\"), option_parse_strategy),\n \tOPT_CALLBACK('X', \"strategy-option\", &xopts, N_(\"option=value\"),\n-- \n2.7.3\n"},{"id":"288045","messageId":"1464799289-7639-32-git-send-email-vascomalmeida@sapo.pt","threadId":"42506","inReplyTo":"1464799289-7639-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v3 31/39] i18n: sequencer: add period to error message","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-06-01T16:41:21Z","receivedAt":"2016-06-01T16:41:21Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Add a period to error message so it matches others instances in\nsequencer.c. Now translator would have to translate such message only\nonce.\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n sequencer.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/sequencer.c b/sequencer.c\nindex 57b3671..e916387 100644\n--- a/sequencer.c\n+++ b/sequencer.c\n@@ -190,7 +190,7 @@ static void write_message(struct strbuf *msgbuf, const char *filename)\n \t\tdie_errno(_(\"Could not write to %s\"), filename);\n \tstrbuf_release(msgbuf);\n \tif (commit_lock_file(&msg_file) < 0)\n-\t\tdie(_(\"Error wrapping up %s\"), filename);\n+\t\tdie(_(\"Error wrapping up %s.\"), filename);\n }\n \n static struct tree *empty_tree(void)\n-- \n2.7.3\n"},{"id":"288054","messageId":"1464799289-7639-33-git-send-email-vascomalmeida@sapo.pt","threadId":"42506","inReplyTo":"1464799289-7639-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v3 32/39] i18n: standardise messages","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-06-01T16:41:22Z","receivedAt":"2016-06-01T16:41:22Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Standardise messages in order to save translators some work.\n\nNuances fixed in this commit:\n\"failed to read %s\"\n\"read of %s failed\"\n\n\"detach the HEAD at named commit\"\n\"detach HEAD at named commit\"\n\n\"removing '%s' failed\"\n\"failed to remove '%s'\"\n\n\"index file corrupt\"\n\"corrupt index file\"\n\n\"failed to read %s\"\n\"read of %s failed\"\n\n\"detach the HEAD at named commit\"\n\"detach HEAD at named commit\"\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n builtin/apply.c    | 6 +++---\n builtin/checkout.c | 6 +++---\n builtin/repack.c   | 2 +-\n 3 files changed, 7 insertions(+), 7 deletions(-)\n\ndiff --git a/builtin/apply.c b/builtin/apply.c\nindex 8e4da2e..205c9f8f3 100644\n--- a/builtin/apply.c\n+++ b/builtin/apply.c\n@@ -3226,7 +3226,7 @@ static int load_patch_target(struct strbuf *buf,\n {\n \tif (cached || check_index) {\n \t\tif (read_file_or_gitlink(ce, buf))\n-\t\t\treturn error(_(\"read of %s failed\"), name);\n+\t\t\treturn error(_(\"failed to read %s\"), name);\n \t} else if (name) {\n \t\tif (S_ISGITLINK(expected_mode)) {\n \t\t\tif (ce)\n@@ -3237,7 +3237,7 @@ static int load_patch_target(struct strbuf *buf,\n \t\t\treturn error(_(\"reading from '%s' beyond a symbolic link\"), name);\n \t\t} else {\n \t\t\tif (read_old_data(st, name, buf))\n-\t\t\t\treturn error(_(\"read of %s failed\"), name);\n+\t\t\t\treturn error(_(\"failed to read %s\"), name);\n \t\t}\n \t}\n \treturn 0;\n@@ -3282,7 +3282,7 @@ static int load_preimage(struct image *image,\n \t\t\tfree_fragment_list(patch->fragments);\n \t\t\tpatch->fragments = NULL;\n \t\t} else if (status) {\n-\t\t\treturn error(_(\"read of %s failed\"), patch->old_name);\n+\t\t\treturn error(_(\"failed to read %s\"), patch->old_name);\n \t\t}\n \t}\n \ndiff --git a/builtin/checkout.c b/builtin/checkout.c\nindex 3398c61..05c7b71 100644\n--- a/builtin/checkout.c\n+++ b/builtin/checkout.c\n@@ -276,7 +276,7 @@ static int checkout_paths(const struct checkout_opts *opts,\n \n \thold_locked_index(lock_file, 1);\n \tif (read_cache_preload(&opts->pathspec) < 0)\n-\t\treturn error(_(\"corrupt index file\"));\n+\t\treturn error(_(\"index file corrupt\"));\n \n \tif (opts->source_tree)\n \t\tread_tree_some(opts->source_tree, &opts->pathspec);\n@@ -470,7 +470,7 @@ static int merge_working_tree(const struct checkout_opts *opts,\n \n \thold_locked_index(lock_file, 1);\n \tif (read_cache_preload(NULL) < 0)\n-\t\treturn error(_(\"corrupt index file\"));\n+\t\treturn error(_(\"index file corrupt\"));\n \n \tresolve_undo_clear();\n \tif (opts->force) {\n@@ -1138,7 +1138,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)\n \t\tOPT_STRING('B', NULL, &opts.new_branch_force, N_(\"branch\"),\n \t\t\t   N_(\"create/reset and checkout a branch\")),\n \t\tOPT_BOOL('l', NULL, &opts.new_branch_log, N_(\"create reflog for new branch\")),\n-\t\tOPT_BOOL(0, \"detach\", &opts.force_detach, N_(\"detach the HEAD at named commit\")),\n+\t\tOPT_BOOL(0, \"detach\", &opts.force_detach, N_(\"detach HEAD at named commit\")),\n \t\tOPT_SET_INT('t', \"track\",  &opts.track, N_(\"set upstream info for new branch\"),\n \t\t\tBRANCH_TRACK_EXPLICIT),\n \t\tOPT_STRING(0, \"orphan\", &opts.new_orphan_branch, N_(\"new-branch\"), N_(\"new unparented branch\")),\ndiff --git a/builtin/repack.c b/builtin/repack.c\nindex 858db38..0108819 100644\n--- a/builtin/repack.c\n+++ b/builtin/repack.c\n@@ -378,7 +378,7 @@ int cmd_repack(int argc, const char **argv, const char *prefix)\n \t\t\t\t\t  item->string,\n \t\t\t\t\t  exts[ext].name);\n \t\t\tif (remove_path(fname))\n-\t\t\t\twarning(_(\"removing '%s' failed\"), fname);\n+\t\t\t\twarning(_(\"failed to remove '%s'\"), fname);\n \t\t\tfree(fname);\n \t\t}\n \t}\n-- \n2.7.3\n"},{"id":"288052","messageId":"1464799289-7639-34-git-send-email-vascomalmeida@sapo.pt","threadId":"42506","inReplyTo":"1464799289-7639-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v3 33/39] i18n: remote: mark URL fallback text for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-06-01T16:41:23Z","receivedAt":"2016-06-01T16:41:23Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Marks fallback text for translation that may be displayed in git remote\nshow output.\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n builtin/remote.c | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/builtin/remote.c b/builtin/remote.c\nindex ae74da6..9f934cb 100644\n--- a/builtin/remote.c\n+++ b/builtin/remote.c\n@@ -1158,11 +1158,11 @@ static int show(int argc, const char **argv)\n \t\t\t   the one in \"  Fetch URL: %s\" translation */\n \t\t\tprintf_ln(_(\"  Push  URL: %s\"), url[i]);\n \t\tif (!i)\n-\t\t\tprintf_ln(_(\"  Push  URL: %s\"), \"(no URL)\");\n+\t\t\tprintf_ln(_(\"  Push  URL: %s\"), _(\"(no URL)\"));\n \t\tif (no_query)\n-\t\t\tprintf_ln(_(\"  HEAD branch: %s\"), \"(not queried)\");\n+\t\t\tprintf_ln(_(\"  HEAD branch: %s\"), _(\"(not queried)\"));\n \t\telse if (!states.heads.nr)\n-\t\t\tprintf_ln(_(\"  HEAD branch: %s\"), \"(unknown)\");\n+\t\t\tprintf_ln(_(\"  HEAD branch: %s\"), _(\"(unknown)\"));\n \t\telse if (states.heads.nr == 1)\n \t\t\tprintf_ln(_(\"  HEAD branch: %s\"), states.heads.items[0].string);\n \t\telse {\n-- \n2.7.3\n"},{"id":"288058","messageId":"xmqq4m9czu5u.fsf@gitster.mtv.corp.google.com","threadId":"42506","inReplyTo":"1464799289-7639-25-git-send-email-vascomalmeida@sapo.pt","subject":"Re: [PATCH v3 24/39] i18n: bisect: enable l10n of bisect terms in messages","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-06-01T17:38:21Z","receivedAt":"2016-06-01T17:38:21Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Vasco Almeida <vascomalmeida@sapo.pt> writes:\n\n> +enum term { BAD, GOOD, OLD, NEW };\n> +static const char *term_names[] = {\n> +/* TRANSLATORS: in bisect.c source code file, the following terms are\n> +   used to describe a \"bad commit\", \"good commit\", \"new revision\", etc.\n> +   Please, if you can, check the source when you are not sure if a %s\n> +   would be replaced by one of the following terms. */\n> +\tN_(\"bad\"), N_(\"good\"), N_(\"old\"), N_(\"new\"),  NULL\n> +};\n> +\n>  /* Remember to update object flag allocation in object.h */\n>  #define COUNTED\t\t(1u<<16)\n>  \n> @@ -725,12 +734,12 @@ static void handle_bad_merge_base(void)\n>  \tif (is_expected_rev(current_bad_oid)) {\n>  \t\tchar *bad_hex = oid_to_hex(current_bad_oid);\n>  \t\tchar *good_hex = join_sha1_array_hex(&good_revs, ' ');\n> -\t\tif (!strcmp(term_bad, \"bad\") && !strcmp(term_good, \"good\")) {\n> +\t\tif (!strcmp(term_bad, term_names[BAD]) && !strcmp(term_good, term_names[GOOD])) {\n>  \t\t\tfprintf(stderr, _(\"The merge base %s is bad.\\n\"\n>  \t\t\t\t\"This means the bug has been fixed \"\n>  \t\t\t\t\"between %s and [%s].\\n\"),\n>  \t\t\t\tbad_hex, bad_hex, good_hex);\n> -\t\t} else if (!strcmp(term_bad, \"new\") && !strcmp(term_good, \"old\")) {\n> +\t\t} else if (!strcmp(term_bad, term_names[NEW]) && !strcmp(term_good, term_names[OLD])) {\n>  \t\t\tfprintf(stderr, _(\"The merge base %s is new.\\n\"\n>  \t\t\t\t\"The property has changed \"\n>  \t\t\t\t\"between %s and [%s].\\n\"),\n> @@ -739,7 +748,7 @@ static void handle_bad_merge_base(void)\n>  \t\t\tfprintf(stderr, _(\"The merge base %s is %s.\\n\"\n>  \t\t\t\t\"This means the first '%s' commit is \"\n>  \t\t\t\t\"between %s and [%s].\\n\"),\n> -\t\t\t\tbad_hex, term_bad, term_good, bad_hex, good_hex);\n> +\t\t\t\tbad_hex, _(term_bad), _(term_good), bad_hex, good_hex);\n\nThese \"bad\" and \"good\" that are compared with term_bad and term_good\nare the literal tokens the end user gives from the \"git bisect\"\ncommand line.  I do not think you would want to catch them with\n\n    $ git bisect novo <rev>\n    $ git bisect velho <rev>\n\nunless the user has done\n\n    $ git bisect --term-old=velho --term-new=novo\n\npreviously.\n\nAnd that \"custom bisect terms\" case is covered by the last \"else\"\nclause in this if/elseif cascade (outside the context we can see in\nyour message).\n\nThe only thing you need to do around here is to mark the string as\ntranslatable.  I do not think we need \"enum term\", or term_names[].\n\n> @@ -747,7 +756,7 @@ static void handle_bad_merge_base(void)\n>  \tfprintf(stderr, _(\"Some %s revs are not ancestor of the %s rev.\\n\"\n>  \t\t\"git bisect cannot work properly in this case.\\n\"\n>  \t\t\"Maybe you mistook %s and %s revs?\\n\"),\n> -\t\tterm_good, term_bad, term_good, term_bad);\n> +\t\t_(term_good), _(term_bad), _(term_good), _(term_bad));\n\nLikewise for all _(term_good), _(term_bad) and use of term_names[]\nwe see in this patch.\n"},{"id":"288059","messageId":"xmqqzir4yfcq.fsf@gitster.mtv.corp.google.com","threadId":"42506","inReplyTo":"1464799289-7639-29-git-send-email-vascomalmeida@sapo.pt","subject":"Re: [PATCH v3 28/39] i18n: config: unfold error messages marked for translation","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-06-01T17:43:33Z","receivedAt":"2016-06-01T17:43:33Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Vasco Almeida <vascomalmeida@sapo.pt> writes:\n\n> Introduced in 473166b (\"config: add 'origin_type' to config_source\n> struct\", 2016-02-19), Git can inform the user about the origin of a\n> config error, but the implementation does not allow translators to\n> translate the keywords 'file', 'blob, 'standard input', and\n> 'submodule-blob'. Moreover, for the second message, a reason for the\n> error is appended to the message, not allowing translators to translate\n> that reason either.\n\nGood intentions.\n\n> @@ -417,6 +417,7 @@ static int git_parse_source(config_fn_t fn, void *data)\n>  \tint comment = 0;\n>  \tint baselen = 0;\n>  \tstruct strbuf *var = &cf->var;\n> +\tchar error_msg[128];\n>  \n>  \t/* U+FEFF Byte Order Mark in UTF8 */\n>  \tconst char *bomptr = utf8_bom;\n> @@ -471,10 +472,38 @@ static int git_parse_source(config_fn_t fn, void *data)\n>  \t\tif (get_value(fn, data, var) < 0)\n>  \t\t\tbreak;\n>  \t}\n> +\n> +\tswitch (cf->origin_type) {\n> +\tcase CFG_BLOB:\n> +\t\txsnprintf(error_msg, sizeof(error_msg),\n> +\t\t\t  _(\"bad config line %d in blob %s\"),\n> +\t\t\t  cf->linenr, cf->name);\n\nUse xstrfmt() intead, perhaps?  That would be cleaner.\n"},{"id":"288060","messageId":"1464804783-10195-5-git-send-email-vascomalmeida@sapo.pt","threadId":"42506","inReplyTo":"1464799289-7639-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v3 34/39] i18n: remote: allow translations to reorder message","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-06-01T18:12:58Z","receivedAt":"2016-06-01T18:12:58Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Before this patch, translations couldn't place the branch name\nwhere it was better fit in the message \"and with remote <branch_name>\".\nAllow translations that, instead of forcing the branch name to display\nright of the message.\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n builtin/remote.c | 7 +++----\n 1 file changed, 3 insertions(+), 4 deletions(-)\n\ndiff --git a/builtin/remote.c b/builtin/remote.c\nindex 9f934cb..7f0f78b 100644\n--- a/builtin/remote.c\n+++ b/builtin/remote.c\n@@ -952,7 +952,7 @@ static int show_local_info_item(struct string_list_item *item, void *cb_data)\n \tstruct show_info *show_info = cb_data;\n \tstruct branch_info *branch_info = item->util;\n \tstruct string_list *merge = &branch_info->merge;\n-\tconst char *also;\n+\tint width = show_info->width + 4;\n \tint i;\n \n \tif (branch_info->rebase && branch_info->merge.nr > 1) {\n@@ -969,13 +969,12 @@ static int show_local_info_item(struct string_list_item *item, void *cb_data)\n \t\treturn 0;\n \t} else if (show_info->any_rebase) {\n \t\tprintf_ln(_(\" merges with remote %s\"), merge->items[0].string);\n-\t\talso = _(\"    and with remote\");\n+\t\twidth++;\n \t} else {\n \t\tprintf_ln(_(\"merges with remote %s\"), merge->items[0].string);\n-\t\talso = _(\"   and with remote\");\n \t}\n \tfor (i = 1; i < merge->nr; i++)\n-\t\tprintf(\"    %-*s %s %s\\n\", show_info->width, \"\", also,\n+\t\tprintf(_(\"%-*s    and with remote %s\\n\"), width, \"\",\n \t\t       merge->items[i].string);\n \n \treturn 0;\n-- \n2.7.3\n"},{"id":"288062","messageId":"1464804783-10195-6-git-send-email-vascomalmeida@sapo.pt","threadId":"42506","inReplyTo":"1464799289-7639-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v3 35/39] i18n: init-db: join message pieces","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-06-01T18:12:59Z","receivedAt":"2016-06-01T18:12:59Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Join message displayed during repository initialization in one entire\nsentence. That would improve translations since it's easier translate an\nentire sentence than translating each piece.\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n builtin/init-db.c | 17 ++++++++++-------\n 1 file changed, 10 insertions(+), 7 deletions(-)\n\ndiff --git a/builtin/init-db.c b/builtin/init-db.c\nindex b2d8d40..3a45f0b 100644\n--- a/builtin/init-db.c\n+++ b/builtin/init-db.c\n@@ -397,13 +397,16 @@ int init_db(const char *template_dir, unsigned int flags)\n \tif (!(flags & INIT_DB_QUIET)) {\n \t\tint len = strlen(git_dir);\n \n-\t\t/* TRANSLATORS: The first '%s' is either \"Reinitialized\n-\t\t   existing\" or \"Initialized empty\", the second \" shared\" or\n-\t\t   \"\", and the last '%s%s' is the verbatim directory name. */\n-\t\tprintf(_(\"%s%s Git repository in %s%s\\n\"),\n-\t\t       reinit ? _(\"Reinitialized existing\") : _(\"Initialized empty\"),\n-\t\t       get_shared_repository() ? _(\" shared\") : \"\",\n-\t\t       git_dir, len && git_dir[len-1] != '/' ? \"/\" : \"\");\n+\t\tif (reinit)\n+\t\t\tprintf(get_shared_repository()\n+\t\t\t       ? _(\"Reinitialized existing shared Git repository in %s%s\\n\")\n+\t\t\t       : _(\"Reinitialized existing Git repository in %s%s\\n\"),\n+\t\t\t       git_dir, len && git_dir[len-1] != '/' ? \"/\" : \"\");\n+\t\telse\n+\t\t\tprintf(get_shared_repository()\n+\t\t\t       ? _(\"Initialized empty shared Git repository in %s%s\\n\")\n+\t\t\t       : _(\"Initialized empty Git repository in %s%s\\n\"),\n+\t\t\t       git_dir, len && git_dir[len-1] != '/' ? \"/\" : \"\");\n \t}\n \n \treturn 0;\n-- \n2.7.3\n"},{"id":"288064","messageId":"1464804783-10195-7-git-send-email-vascomalmeida@sapo.pt","threadId":"42506","inReplyTo":"1464799289-7639-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v3 36/39] i18n: submodule: join strings marked for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-06-01T18:13:00Z","receivedAt":"2016-06-01T18:13:00Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Join strings marked for translation since that would facilitate and\nimprove translations result.\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n git-submodule.sh | 18 ++++++++++--------\n 1 file changed, 10 insertions(+), 8 deletions(-)\n\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex 5a4dec0..91fca56 100755\n--- a/git-submodule.sh\n+++ b/git-submodule.sh\n@@ -275,14 +275,15 @@ Use -f if you really want to add it.\" >&2\n \t\tthen\n \t\t\tif test -z \"$force\"\n \t\t\tthen\n-\t\t\t\techo >&2 \"$(eval_gettext \"A git directory for '\\$sm_name' is found locally with remote(s):\")\"\n+\t\t\t\teval_gettextln >&2 \"A git directory for '\\$sm_name' is found locally with remote(s):\"\n \t\t\t\tGIT_DIR=\".git/modules/$sm_name\" GIT_WORK_TREE=. git remote -v | grep '(fetch)' | sed -e s,^,\"  \", -e s,' (fetch)',, >&2\n-\t\t\t\techo >&2 \"$(eval_gettext \"If you want to reuse this local git directory instead of cloning again from\")\"\n-\t\t\t\techo >&2 \"  $realrepo\"\n-\t\t\t\techo >&2 \"$(eval_gettext \"use the '--force' option. If the local git directory is not the correct repo\")\"\n-\t\t\t\tdie \"$(eval_gettext \"or you are unsure what this means choose another name with the '--name' option.\")\"\n+\t\t\t\tdie \"$(eval_gettextln \"\\\n+If you want to reuse this local git directory instead of cloning again from\n+  \\$realrepo\n+use the '--force' option. If the local git directory is not the correct repo\n+or you are unsure what this means choose another name with the '--name' option.\")\"\n \t\t\telse\n-\t\t\t\techo \"$(eval_gettext \"Reactivating local git directory for submodule '\\$sm_name'.\")\"\n+\t\t\t\teval_gettextln \"Reactivating local git directory for submodule '\\$sm_name'.\"\n \t\t\tfi\n \t\tfi\n \t\tgit submodule--helper clone ${GIT_QUIET:+--quiet} --prefix \"$wt_prefix\" --path \"$sm_path\" --name \"$sm_name\" --url \"$realrepo\" ${reference:+\"$reference\"} ${depth:+\"$depth\"} || exit\n@@ -467,8 +468,9 @@ cmd_deinit()\n \t\t\t# Protect submodules containing a .git directory\n \t\t\tif test -d \"$sm_path/.git\"\n \t\t\tthen\n-\t\t\t\techo >&2 \"$(eval_gettext \"Submodule work tree '\\$displaypath' contains a .git directory\")\"\n-\t\t\t\tdie \"$(eval_gettext \"(use 'rm -rf' if you really want to remove it including all of its history)\")\"\n+\t\t\t\tdie \"$(eval_gettext \"\\\n+Submodule work tree '\\$displaypath' contains a .git directory\n+(use 'rm -rf' if you really want to remove it including all of its history)\")\"\n \t\t\tfi\n \n \t\t\tif test -z \"$force\"\n-- \n2.7.3\n"},{"id":"288065","messageId":"1464804783-10195-8-git-send-email-vascomalmeida@sapo.pt","threadId":"42506","inReplyTo":"1464799289-7639-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v3 37/39] i18n: submodule: escape shell variables inside eval_gettext","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-06-01T18:13:01Z","receivedAt":"2016-06-01T18:13:01Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"According to the gettext manual [1], references to shell variables inside\neval_gettext call must be escaped so that eval_gettext receives the\ntranslatable string before the variable values are substituted into it.\n\n[1] http://www.gnu.org/software/gettext/manual/html_node/Preparing-Shell-Scripts.html\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n git-submodule.sh | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/git-submodule.sh b/git-submodule.sh\nindex 91fca56..75a7ebe 100755\n--- a/git-submodule.sh\n+++ b/git-submodule.sh\n@@ -648,7 +648,7 @@ cmd_update()\n \t\t\tremote_name=$(sanitize_submodule_env; cd \"$sm_path\" && get_default_remote)\n \t\t\tsha1=$(sanitize_submodule_env; cd \"$sm_path\" &&\n \t\t\t\tgit rev-parse --verify \"${remote_name}/${branch}\") ||\n-\t\t\tdie \"$(eval_gettext \"Unable to find current ${remote_name}/${branch} revision in submodule path '\\$sm_path'\")\"\n+\t\t\tdie \"$(eval_gettext \"Unable to find current \\${remote_name}/\\${branch} revision in submodule path '\\$sm_path'\")\"\n \t\tfi\n \n \t\tif test \"$subsha1\" != \"$sha1\" || test -n \"$force\"\n@@ -672,7 +672,7 @@ cmd_update()\n \t\t\t\t# not be reachable from any of the refs\n \t\t\t\tis_tip_reachable \"$sm_path\" \"$sha1\" ||\n \t\t\t\tfetch_in_submodule \"$sm_path\" \"$sha1\" ||\n-\t\t\t\tdie \"$(eval_gettext \"Fetched in submodule path '\\$displaypath', but it did not contain $sha1. Direct fetching of that commit failed.\")\"\n+\t\t\t\tdie \"$(eval_gettext \"Fetched in submodule path '\\$displaypath', but it did not contain \\$sha1. Direct fetching of that commit failed.\")\"\n \t\t\tfi\n \n \t\t\tmust_die_on_failure=\n-- \n2.7.3\n"},{"id":"288066","messageId":"1464804783-10195-9-git-send-email-vascomalmeida@sapo.pt","threadId":"42506","inReplyTo":"1464799289-7639-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v3 38/39] i18n: unmark die messages for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-06-01T18:13:02Z","receivedAt":"2016-06-01T18:13:02Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"These messages are relevant for the programmer only, not for the end\nuser.  Thus, they can be unmarked for translation, saving translator\nsome work.\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n git-bisect.sh | 2 +-\n wt-status.c   | 4 ++--\n 2 files changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/git-bisect.sh b/git-bisect.sh\nindex 737bf05..c9acab6 100755\n--- a/git-bisect.sh\n+++ b/git-bisect.sh\n@@ -275,7 +275,7 @@ bisect_state() {\n \tcheck_and_set_terms $state\n \tcase \"$#,$state\" in\n \t0,*)\n-\t\tdie \"$(gettext \"Please call 'bisect_state' with at least one argument.\")\" ;;\n+\t\tdie \"Please call 'bisect_state' with at least one argument.\" ;;\n \t1,\"$TERM_BAD\"|1,\"$TERM_GOOD\"|1,skip)\n \t\tbisected_head=$(bisect_head)\n \t\trev=$(git rev-parse --verify \"$bisected_head\") ||\ndiff --git a/wt-status.c b/wt-status.c\nindex 4f27bd6..5a91279 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -263,7 +263,7 @@ static const char *wt_status_unmerged_status_string(int stagemask)\n \tcase 7:\n \t\treturn _(\"both modified:\");\n \tdefault:\n-\t\tdie(_(\"bug: unhandled unmerged status %x\"), stagemask);\n+\t\tdie(\"bug: unhandled unmerged status %x\", stagemask);\n \t}\n }\n \n@@ -388,7 +388,7 @@ static void wt_status_print_change_data(struct wt_status *s,\n \tstatus_printf(s, color(WT_STATUS_HEADER, s), \"\\t\");\n \twhat = wt_status_diff_status_string(status);\n \tif (!what)\n-\t\tdie(_(\"bug: unhandled diff status %c\"), status);\n+\t\tdie(\"bug: unhandled diff status %c\", status);\n \tlen = label_width - utf8_strwidth(what);\n \tassert(len >= 0);\n \tif (status == DIFF_STATUS_COPIED || status == DIFF_STATUS_RENAMED)\n-- \n2.7.3\n"},{"id":"288061","messageId":"1464804783-10195-10-git-send-email-vascomalmeida@sapo.pt","threadId":"42506","inReplyTo":"1464799289-7639-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH v3 39/39] i18n: branch: mark comment when editing branch description for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-06-01T18:13:03Z","receivedAt":"2016-06-01T18:13:03Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"When one issues git branch --edit-description branch_name, a edit with\nthat message commented out is opened. Mark that message for translation\nin to order to be localized.\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n builtin/branch.c | 6 +++---\n 1 file changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/builtin/branch.c b/builtin/branch.c\nindex 2ecde53..12203fd 100644\n--- a/builtin/branch.c\n+++ b/builtin/branch.c\n@@ -614,9 +614,9 @@ static int edit_branch_description(const char *branch_name)\n \tif (!buf.len || buf.buf[buf.len-1] != '\\n')\n \t\tstrbuf_addch(&buf, '\\n');\n \tstrbuf_commented_addf(&buf,\n-\t\t    \"Please edit the description for the branch\\n\"\n-\t\t    \"  %s\\n\"\n-\t\t    \"Lines starting with '%c' will be stripped.\\n\",\n+\t\t    _(\"Please edit the description for the branch\\n\"\n+\t\t      \"  %s\\n\"\n+\t\t      \"Lines starting with '%c' will be stripped.\\n\"),\n \t\t    branch_name, comment_line_char);\n \tif (write_file_gently(git_path(edit_description), \"%s\", buf.buf)) {\n \t\tstrbuf_release(&buf);\n-- \n2.7.3\n"},{"id":"288067","messageId":"xmqqvb1sydmu.fsf@gitster.mtv.corp.google.com","threadId":"42506","inReplyTo":"1464799289-7639-14-git-send-email-vascomalmeida@sapo.pt","subject":"Re: [PATCH v3 13/39] i18n: git-sh-setup.sh: mark strings for translation","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-06-01T18:20:41Z","receivedAt":"2016-06-01T18:20:41Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Vasco Almeida <vascomalmeida@sapo.pt> writes:\n\n> Positional arguments, such as $0, $1, etc, need to be stored on shell\n> variables for use in translatable strings, according to gettext manual\n> [1].\n>\n> Add git-sh-setup.sh to LOCALIZED_SH variable in Makefile to enable\n> extraction of string marked for translation by xgettext.\n>\n> Although git-sh-setup.sh is a shell library to be sourced by other shell\n> scripts, it is necessary to source git-sh-i18n at this point, because\n> some scripts don't do it themselves. Not sourcing git-sh-i18n would lead\n> to failure due to, for instance, gettextln not being found.\n\nThat is correct, but doesn't that hint that the current users of\ngit-sh-i18n no longer have to (and they probably do not want to)\ndot-source it, as they are already dot-sourcing git-sh-setup?\n\nOtherwise they will waste cycles reading the same thing twice\n(assuming that git-sh-i18n is safely read twice, that is).\n\n> Source \"$(git --exec-path)\"/git-sh-i18n instead of simply git-sh-i18n,\n\nThat is somewhat strange.  \"git-rebase.sh\" dot-sources both\ngit-sh-setup and git-sh-i18n with just \". $name\".  What is so\nspecial about sh-setup dot-sourcing sh-i18n your patch adds?\n\n> because latter case would fail test t2300-cd-to-toplevel.sh.\n\nWhat is the real cause of this?\n\n\". git-sh-setup\" is supposed to work because we prepend the\n$GIT_EXEC_PATH in \"git\" itself and git-sh-setup is installed there.\n\". git-sh-i18n\" in \"git-rebase.sh\" works the same way.  If it is\nbecause is t2300 doing something strange, then we should fix that,\nnot adding $(git --exec-path) on the dot-source line to paper things\nover.\n"},{"id":"288079","messageId":"xmqqd1o0y7m0.fsf@gitster.mtv.corp.google.com","threadId":"42506","inReplyTo":"xmqqvb1sydmu.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH v3 13/39] i18n: git-sh-setup.sh: mark strings for translation","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-06-01T20:30:47Z","receivedAt":"2016-06-01T20:30:47Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> That is correct, but doesn't that hint that the current users of\n> git-sh-i18n no longer have to (and they probably do not want to)\n> dot-source it, as they are already dot-sourcing git-sh-setup?\n>\n> Otherwise they will waste cycles reading the same thing twice\n> (assuming that git-sh-i18n is safely read twice, that is).\n\nThis part still stands.\n\nIf we assume that it is a good idea to i18n shell functions that are\nsupplied by git-sh-setup, it might be a better direction to retire\ngit-sh-i18n and include its text directly in git-sh-setup, so that\nany scripted Porcelain has to open just one file to dot-source it,\ninstead of two.\n\n>> Source \"$(git --exec-path)\"/git-sh-i18n instead of simply git-sh-i18n,\n>\n> That is somewhat strange.  \"git-rebase.sh\" dot-sources both\n> git-sh-setup and git-sh-i18n with just \". $name\".  What is so\n> special about sh-setup dot-sourcing sh-i18n your patch adds?\n>\n>> because latter case would fail test t2300-cd-to-toplevel.sh.\n>\n> What is the real cause of this?\n>\n> \". git-sh-setup\" is supposed to work because we prepend the\n> $GIT_EXEC_PATH in \"git\" itself and git-sh-setup is installed there.\n> \". git-sh-i18n\" in \"git-rebase.sh\" works the same way.  If it is\n> because is t2300 doing something strange, then we should fix that,\n> not adding $(git --exec-path) on the dot-source line to paper things\n> over.\n\nThis because what t2300 does is strange; I wouldn't call it \"wrong\"\nper se, but it is borderline wrong.\n\nWould it allow you to lose the $(git --exec-path) prefix in the new\ndot-source to have this patch before applying your patch?\n\n-- >8 --\nSubject: t2300: run git-sh-setup in an environment that better mimics the real life\n\nWhen we run scripted Porcelains, \"git\" potty has set up the $PATH by\nprepending $GIT_EXEC_PATH, the path given by \"git --exec-path=$there\n$cmd\", etc. already.  Because of this, scripted Porcelains can\ndot-source shell script library like git-sh-setup with simple dot\nwithout specifying any path.\n\nt2300 however dot-sources git-sh-setup without adjusting $PATH like\nthe real \"git\" potty does.  This has not been a problem so far, but\nonce git-sh-setup wants to rely on the $PATH adjustment, just like\nany scripted Porcelains already do, it would become one.  It cannot\nfor example dot-source another shell library without specifying the\nfull path to it by prefixing $(git --exec-path).\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n t/t2300-cd-to-toplevel.sh | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/t/t2300-cd-to-toplevel.sh b/t/t2300-cd-to-toplevel.sh\nindex 9965bc5..cccd7d9 100755\n--- a/t/t2300-cd-to-toplevel.sh\n+++ b/t/t2300-cd-to-toplevel.sh\n@@ -8,7 +8,8 @@ test_cd_to_toplevel () {\n \ttest_expect_success $3 \"$2\" '\n \t\t(\n \t\t\tcd '\"'$1'\"' &&\n-\t\t\t. \"$(git --exec-path)\"/git-sh-setup &&\n+\t\t\tPATH=\"$(git --exec-path):$PATH\" &&\n+\t\t\t. git-sh-setup &&\n \t\t\tcd_to_toplevel &&\n \t\t\t[ \"$(pwd -P)\" = \"$TOPLEVEL\" ]\n \t\t)\n"},{"id":"288122","messageId":"574FF6A6.8030609@sapo.pt","threadId":"42506","inReplyTo":"xmqq4m9czu5u.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH v3 24/39] i18n: bisect: enable l10n of bisect terms in messages","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-06-02T09:04:38Z","receivedAt":"2016-06-02T09:04:38Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Às 17:38 de 01-06-2016, Junio C Hamano escreveu:\n> Vasco Almeida <vascomalmeida@sapo.pt> writes:\n> \n>> +enum term { BAD, GOOD, OLD, NEW };\n>> +static const char *term_names[] = {\n>> +/* TRANSLATORS: in bisect.c source code file, the following terms are\n>> +   used to describe a \"bad commit\", \"good commit\", \"new revision\", etc.\n>> +   Please, if you can, check the source when you are not sure if a %s\n>> +   would be replaced by one of the following terms. */\n>> +\tN_(\"bad\"), N_(\"good\"), N_(\"old\"), N_(\"new\"),  NULL\n>> +};\n>> +\n>>  /* Remember to update object flag allocation in object.h */\n>>  #define COUNTED\t\t(1u<<16)\n>>  \n>> @@ -725,12 +734,12 @@ static void handle_bad_merge_base(void)\n>>  \tif (is_expected_rev(current_bad_oid)) {\n>>  \t\tchar *bad_hex = oid_to_hex(current_bad_oid);\n>>  \t\tchar *good_hex = join_sha1_array_hex(&good_revs, ' ');\n>> -\t\tif (!strcmp(term_bad, \"bad\") && !strcmp(term_good, \"good\")) {\n>> +\t\tif (!strcmp(term_bad, term_names[BAD]) && !strcmp(term_good, term_names[GOOD])) {\n>>  \t\t\tfprintf(stderr, _(\"The merge base %s is bad.\\n\"\n>>  \t\t\t\t\"This means the bug has been fixed \"\n>>  \t\t\t\t\"between %s and [%s].\\n\"),\n>>  \t\t\t\tbad_hex, bad_hex, good_hex);\n>> -\t\t} else if (!strcmp(term_bad, \"new\") && !strcmp(term_good, \"old\")) {\n>> +\t\t} else if (!strcmp(term_bad, term_names[NEW]) && !strcmp(term_good, term_names[OLD])) {\n>>  \t\t\tfprintf(stderr, _(\"The merge base %s is new.\\n\"\n>>  \t\t\t\t\"The property has changed \"\n>>  \t\t\t\t\"between %s and [%s].\\n\"),\n>> @@ -739,7 +748,7 @@ static void handle_bad_merge_base(void)\n>>  \t\t\tfprintf(stderr, _(\"The merge base %s is %s.\\n\"\n>>  \t\t\t\t\"This means the first '%s' commit is \"\n>>  \t\t\t\t\"between %s and [%s].\\n\"),\n>> -\t\t\t\tbad_hex, term_bad, term_good, bad_hex, good_hex);\n>> +\t\t\t\tbad_hex, _(term_bad), _(term_good), bad_hex, good_hex);\n> \n> These \"bad\" and \"good\" that are compared with term_bad and term_good\n> are the literal tokens the end user gives from the \"git bisect\"\n> command line.  I do not think you would want to catch them with\n> \n>     $ git bisect novo <rev>\n>     $ git bisect velho <rev>\n> \n> unless the user has done\n> \n>     $ git bisect --term-old=velho --term-new=novo\n> \n> previously.\n\nI may be misunderstanding you, but we do not \"catch\" those terms with\nthis patch, although I'm not sure what you mean by \"catch them\". I think\nyou forget that no-operation N_(\"good\"), does not affect in any way the\nstring \"good\", it only enables xgettext to extract it to .pot file, does\nnot trigger translation.\nOverall, I don't understand what are you trying to tell me here.\n\n> \n> And that \"custom bisect terms\" case is covered by the last \"else\"\n> clause in this if/elseif cascade (outside the context we can see in\n> your message).\n> \n> The only thing you need to do around here is to mark the string as\n> translatable.  I do not think we need \"enum term\", or term_names[].\n\nThis patch tries to make bisect output those term translated within the\nalso translated message. To enable this, it is handy to have\nterm_names[] in order to mark each term, although I could have mark them\nanywhere they appeared in the source. It was only for that I chose to\nhave term_names[].\n> \n>> @@ -747,7 +756,7 @@ static void handle_bad_merge_base(void)\n>>  \tfprintf(stderr, _(\"Some %s revs are not ancestor of the %s rev.\\n\"\n>>  \t\t\"git bisect cannot work properly in this case.\\n\"\n>>  \t\t\"Maybe you mistook %s and %s revs?\\n\"),\n>> -\t\tterm_good, term_bad, term_good, term_bad);\n>> +\t\t_(term_good), _(term_bad), _(term_good), _(term_bad));\n> \n> Likewise for all _(term_good), _(term_bad) and use of term_names[]\n> we see in this patch.\n> \n\nIndeed this was more of a PATCH/RFC to see what people would think of\nit. If nobody contest and there is no value in it, I'll happily drop\nthis patch in the next re-roll.\n\nMy motivation for this patch was that a user could feel embarrassment\nreading a message in her language with those terms untranslated.\nAlthough I do believe that no translating them is also a possibility.\n"},{"id":"288123","messageId":"574FFC49.9040409@sapo.pt","threadId":"42506","inReplyTo":"xmqqzir4yfcq.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH v3 28/39] i18n: config: unfold error messages marked for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-06-02T09:28:41Z","receivedAt":"2016-06-02T09:28:41Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Às 17:43 de 01-06-2016, Junio C Hamano escreveu:\n> Vasco Almeida <vascomalmeida@sapo.pt> writes:\n> \n>> Introduced in 473166b (\"config: add 'origin_type' to config_source\n>> struct\", 2016-02-19), Git can inform the user about the origin of a\n>> config error, but the implementation does not allow translators to\n>> translate the keywords 'file', 'blob, 'standard input', and\n>> 'submodule-blob'. Moreover, for the second message, a reason for the\n>> error is appended to the message, not allowing translators to translate\n>> that reason either.\n> \n> Good intentions.\n> \n>> @@ -417,6 +417,7 @@ static int git_parse_source(config_fn_t fn, void *data)\n>>  \tint comment = 0;\n>>  \tint baselen = 0;\n>>  \tstruct strbuf *var = &cf->var;\n>> +\tchar error_msg[128];\n>>  \n>>  \t/* U+FEFF Byte Order Mark in UTF8 */\n>>  \tconst char *bomptr = utf8_bom;\n>> @@ -471,10 +472,38 @@ static int git_parse_source(config_fn_t fn, void *data)\n>>  \t\tif (get_value(fn, data, var) < 0)\n>>  \t\t\tbreak;\n>>  \t}\n>> +\n>> +\tswitch (cf->origin_type) {\n>> +\tcase CFG_BLOB:\n>> +\t\txsnprintf(error_msg, sizeof(error_msg),\n>> +\t\t\t  _(\"bad config line %d in blob %s\"),\n>> +\t\t\t  cf->linenr, cf->name);\n> \n> Use xstrfmt() intead, perhaps?  That would be cleaner.\n> \nWouldn't that create a memory leak?\nBecause, in this patch, error_msg is used in the following way\n\n        if (cf->die_on_error)\n                die(error_msg);\n        else\n                return error(error_msg);\n"},{"id":"288124","messageId":"57503F3E.1090705@sapo.pt","threadId":"42506","inReplyTo":"xmqqd1o0y7m0.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH v3 13/39] i18n: git-sh-setup.sh: mark strings for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-06-02T14:14:22Z","receivedAt":"2016-06-02T14:14:22Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Às 20:30 de 01-06-2016, Junio C Hamano escreveu:\n> Junio C Hamano <gitster@pobox.com> writes:\n> Would it allow you to lose the $(git --exec-path) prefix in the new\n> dot-source to have this patch before applying your patch?\n> \n> -- >8 --\n> Subject: t2300: run git-sh-setup in an environment that better mimics the real life\n> \n> When we run scripted Porcelains, \"git\" potty has set up the $PATH by\n> prepending $GIT_EXEC_PATH, the path given by \"git --exec-path=$there\n> $cmd\", etc. already.  Because of this, scripted Porcelains can\n> dot-source shell script library like git-sh-setup with simple dot\n> without specifying any path.\n> \n> t2300 however dot-sources git-sh-setup without adjusting $PATH like\n> the real \"git\" potty does.  This has not been a problem so far, but\n> once git-sh-setup wants to rely on the $PATH adjustment, just like\n> any scripted Porcelains already do, it would become one.  It cannot\n> for example dot-source another shell library without specifying the\n> full path to it by prefixing $(git --exec-path).\n> \n> Signed-off-by: Junio C Hamano <gitster@pobox.com>\n> ---\n>  t/t2300-cd-to-toplevel.sh | 3 ++-\n>  1 file changed, 2 insertions(+), 1 deletion(-)\n> \n> diff --git a/t/t2300-cd-to-toplevel.sh b/t/t2300-cd-to-toplevel.sh\n> index 9965bc5..cccd7d9 100755\n> --- a/t/t2300-cd-to-toplevel.sh\n> +++ b/t/t2300-cd-to-toplevel.sh\n> @@ -8,7 +8,8 @@ test_cd_to_toplevel () {\n>  \ttest_expect_success $3 \"$2\" '\n>  \t\t(\n>  \t\t\tcd '\"'$1'\"' &&\n> -\t\t\t. \"$(git --exec-path)\"/git-sh-setup &&\n> +\t\t\tPATH=\"$(git --exec-path):$PATH\" &&\n> +\t\t\t. git-sh-setup &&\n>  \t\t\tcd_to_toplevel &&\n>  \t\t\t[ \"$(pwd -P)\" = \"$TOPLEVEL\" ]\n>  \t\t)\n> \nYes, this patch allows to have . git-sh-i18n instead of\n. \"$(git --exec-path)\"/git-sh-i18n in git-sh-setup.sh file.\n"},{"id":"288138","messageId":"xmqqbn3jv6ka.fsf@gitster.mtv.corp.google.com","threadId":"42506","inReplyTo":"574FF6A6.8030609@sapo.pt","subject":"Re: [PATCH v3 24/39] i18n: bisect: enable l10n of bisect terms in messages","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-06-02T17:33:57Z","receivedAt":"2016-06-02T17:33:57Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Vasco Almeida <vascomalmeida@sapo.pt> writes:\n\n> Às 17:38 de 01-06-2016, Junio C Hamano escreveu:\n>> Vasco Almeida <vascomalmeida@sapo.pt> writes:\n>> \n>>> +enum term { BAD, GOOD, OLD, NEW };\n>>> +static const char *term_names[] = {\n>>> +/* TRANSLATORS: in bisect.c source code file, the following terms are\n>>> +   used to describe a \"bad commit\", \"good commit\", \"new revision\", etc.\n>>> +   Please, if you can, check the source when you are not sure if a %s\n>>> +   would be replaced by one of the following terms. */\n>>> +\tN_(\"bad\"), N_(\"good\"), N_(\"old\"), N_(\"new\"),  NULL\n>>> +};\n\nAs you pointed out (below), I _did_ misread these N_() ...\n\n\n>>>  /* Remember to update object flag allocation in object.h */\n>>>  #define COUNTED\t\t(1u<<16)\n>>>  \n>>> @@ -725,12 +734,12 @@ static void handle_bad_merge_base(void)\n>>>  \tif (is_expected_rev(current_bad_oid)) {\n>>>  \t\tchar *bad_hex = oid_to_hex(current_bad_oid);\n>>>  \t\tchar *good_hex = join_sha1_array_hex(&good_revs, ' ');\n>>> -\t\tif (!strcmp(term_bad, \"bad\") && !strcmp(term_good, \"good\")) {\n>>> +\t\tif (!strcmp(term_bad, term_names[BAD]) && !strcmp(term_good, term_names[GOOD])) {\n>>>  \t\t\tfprintf(stderr, _(\"The merge base %s is bad.\\n\"\n>>>  \t\t\t\t\"This means the bug has been fixed \"\n>>>  \t\t\t\t\"between %s and [%s].\\n\"),\n>>>  \t\t\t\tbad_hex, bad_hex, good_hex);\n>>> -\t\t} else if (!strcmp(term_bad, \"new\") && !strcmp(term_good, \"old\")) {\n>>> +\t\t} else if (!strcmp(term_bad, term_names[NEW]) && !strcmp(term_good, term_names[OLD])) {\n\n... which means the above two changes are \"since we have these four\nword constants in an array up there, let's use them\", i.e. there is\nno change in behaviour when running the program in any locale, but\nit is a good programming practice (as long as the term_names[] array\nthat holds the four word constants and indexes into it with enum term\nis justifiable, that is).\n\n>>> @@ -739,7 +748,7 @@ static void handle_bad_merge_base(void)\n>>>  \t\t\tfprintf(stderr, _(\"The merge base %s is %s.\\n\"\n>>>  \t\t\t\t\"This means the first '%s' commit is \"\n>>>  \t\t\t\t\"between %s and [%s].\\n\"),\n>>> -\t\t\t\tbad_hex, term_bad, term_good, bad_hex, good_hex);\n>>> +\t\t\t\tbad_hex, _(term_bad), _(term_good), bad_hex, good_hex);\n\nBut this translation still does not make much sense to me.\n\nIf the user did not change term_bad and term_good from the default\nones (i.e. the four words above), the flow of control would not come\nhere; one of the above two !strcmp() lines you changed would trigger.\n\nOn the other hand, if the user did change term_bad and term_good by\nusing --term-old=velho --term-new=novo earlier (which is stored in\nBISECT_TERMS and read into these two variables), these are strings\nthat Git encounters at runtime; you cannot expect _(term_bad) aka\n_(\"novo\") to be translated by *.po files for the locale.\n\nAnd even if it were somehow translatable, you do not want to.\n\nImagine a case where there is a Portuguese word the user used in\nplace of 'novo' in the example above, and there is an English word\nwith the same spelling with a totally different meaning.  And\nfurther imagine that English word is used elsewhere in Git and has\ntranslation to Portuguese in your *.po file.  _(term_bad) would\nbecome a translation of that English word into Portuguese, which\nwould be a word totally unrelated to the word the user used\noriginally when she did --term-old=<that word in portuguese>.\n\nSo I do not think _(term_bad) and _(term_good) is a good idea in the\nlast hunk quoted above (it is not just \"not a good idea\", but\nactually would be harmful), which would make term_names[] and \"enum\nterm\" unnecessary.\n\nThere is a case where one of the default four words could seep\nthrough to the last else clause.  Is that what you are trying to\naddress?\n\nThat is, when term_bad is left as \"bad\" but term_good is customized\nto \"super\", neither \"term_bad is 'bad' and term_good is 'good'\" nor\n\"term_bad is 'new' and term_good is 'old\" is true, and we would say\n\n\tMerge base is BAD.  This means the first SUPER commit is ...\n\nWith your change to mark _(term_bad) and _(term_good), the message\nwould translate term_bad to whatever word it is in your language,\nand term_good that comes from the end user will be left as SUPER as\nthe user typed.  I am not sure if it is a good thing to translate\nonly BAD while leaving SUPER as-is in such a case.\n"},{"id":"288139","messageId":"xmqq7fe7v6gd.fsf@gitster.mtv.corp.google.com","threadId":"42506","inReplyTo":"574FFC49.9040409@sapo.pt","subject":"Re: [PATCH v3 28/39] i18n: config: unfold error messages marked for translation","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-06-02T17:36:18Z","receivedAt":"2016-06-02T17:36:18Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Vasco Almeida <vascomalmeida@sapo.pt> writes:\n\n> Às 17:43 de 01-06-2016, Junio C Hamano escreveu:\n>> Vasco Almeida <vascomalmeida@sapo.pt> writes:\n>> \n>>> Introduced in 473166b (\"config: add 'origin_type' to config_source\n>>> struct\", 2016-02-19), Git can inform the user about the origin of a\n>>> config error, but the implementation does not allow translators to\n>>> translate the keywords 'file', 'blob, 'standard input', and\n>>> 'submodule-blob'. Moreover, for the second message, a reason for the\n>>> error is appended to the message, not allowing translators to translate\n>>> that reason either.\n>> \n>> Good intentions.\n>> \n>>> @@ -417,6 +417,7 @@ static int git_parse_source(config_fn_t fn, void *data)\n>>>  \tint comment = 0;\n>>>  \tint baselen = 0;\n>>>  \tstruct strbuf *var = &cf->var;\n>>> +\tchar error_msg[128];\n>>>  \n>>>  \t/* U+FEFF Byte Order Mark in UTF8 */\n>>>  \tconst char *bomptr = utf8_bom;\n>>> @@ -471,10 +472,38 @@ static int git_parse_source(config_fn_t fn, void *data)\n>>>  \t\tif (get_value(fn, data, var) < 0)\n>>>  \t\t\tbreak;\n>>>  \t}\n>>> +\n>>> +\tswitch (cf->origin_type) {\n>>> +\tcase CFG_BLOB:\n>>> +\t\txsnprintf(error_msg, sizeof(error_msg),\n>>> +\t\t\t  _(\"bad config line %d in blob %s\"),\n>>> +\t\t\t  cf->linenr, cf->name);\n>> \n>> Use xstrfmt() intead, perhaps?  That would be cleaner.\n>> \n> Wouldn't that create a memory leak?\n\nYes, I didn't mean to suggest \"use xstrfmt() instead of xsnprintf()\nwithout changing anything else\".  It was merely to suggest that you\ndo not have to have 128-byte limit if you used xstrfmt(); having to\nfree the result was too obvious that I left it unsaid, and as expected,\nyou noticed the need to do so, which is good ;-)\n"},{"id":"288250","messageId":"575178D4.5@sapo.pt","threadId":"42506","inReplyTo":"xmqqbn3jv6ka.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH v3 24/39] i18n: bisect: enable l10n of bisect terms in messages","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-06-03T12:32:20Z","receivedAt":"2016-06-03T12:32:20Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Às 17:33 de 02-06-2016, Junio C Hamano escreveu:\n> Vasco Almeida <vascomalmeida@sapo.pt> writes:\n> \n>> Às 17:38 de 01-06-2016, Junio C Hamano escreveu:\n>>> Vasco Almeida <vascomalmeida@sapo.pt> writes:\n>>>\n>>>> @@ -739,7 +748,7 @@ static void handle_bad_merge_base(void)\n>>>>  \t\t\tfprintf(stderr, _(\"The merge base %s is %s.\\n\"\n>>>>  \t\t\t\t\"This means the first '%s' commit is \"\n>>>>  \t\t\t\t\"between %s and [%s].\\n\"),\n>>>> -\t\t\t\tbad_hex, term_bad, term_good, bad_hex, good_hex);\n>>>> +\t\t\t\tbad_hex, _(term_bad), _(term_good), bad_hex, good_hex);\n> \n> But this translation still does not make much sense to me.\n> \n> If the user did not change term_bad and term_good from the default\n> ones (i.e. the four words above), the flow of control would not come\n> here; one of the above two !strcmp() lines you changed would trigger.\n> \nHence, marking _(term_bad) and _(term_good) in this instance is both\nfutile and wrong. Because, at this point of flow, these term were likely\ndefined by the user, therefore must not be translated.\n\n> On the other hand, if the user did change term_bad and term_good by\n> using --term-old=velho --term-new=novo earlier (which is stored in\n> BISECT_TERMS and read into these two variables), these are strings\n> that Git encounters at runtime; you cannot expect _(term_bad) aka\n> _(\"novo\") to be translated by *.po files for the locale.\n> \n> And even if it were somehow translatable, you do not want to.\n> \n> Imagine a case where there is a Portuguese word the user used in\n> place of 'novo' in the example above, and there is an English word\n> with the same spelling with a totally different meaning.  And\n> further imagine that English word is used elsewhere in Git and has\n> translation to Portuguese in your *.po file.  _(term_bad) would\n> become a translation of that English word into Portuguese, which\n> would be a word totally unrelated to the word the user used\n> originally when she did --term-old=<that word in portuguese>.\n> \nI thought about this after sending my last email about this topic. It is\nsomething that can happen indeed.\n\n> So I do not think _(term_bad) and _(term_good) is a good idea in the\n> last hunk quoted above (it is not just \"not a good idea\", but\n> actually would be harmful), which would make term_names[] and \"enum\n> term\" unnecessary.\n> \nI agree with you. I'm going to drop this patch in the next re-roll.\nLeaving the previous patch, [PATCH v3 23/39] i18n: bisect: mark strings\nfor translation, unchanged which just masks the strings for translation\nbut not anything else.\n\n> There is a case where one of the default four words could seep\n> through to the last else clause.  Is that what you are trying to\n> address?\n> \nNo. I was trying to replace the English terms by their translation in\nthose messages. But we have arrive to conclusion it is a bad idea to pursue.\n\n> That is, when term_bad is left as \"bad\" but term_good is customized\n> to \"super\", neither \"term_bad is 'bad' and term_good is 'good'\" nor\n> \"term_bad is 'new' and term_good is 'old\" is true, and we would say\n> \n> \tMerge base is BAD.  This means the first SUPER commit is ...\n> \n> With your change to mark _(term_bad) and _(term_good), the message\n> would translate term_bad to whatever word it is in your language,\n> and term_good that comes from the end user will be left as SUPER as\n> the user typed.  I am not sure if it is a good thing to translate\n> only BAD while leaving SUPER as-is in such a case.\n\nI think this may be confusing for some users. I am positive it is a bad\nthing.\n\n\nIf I had thought more about this, I hadn't proposed this patch. I'm\nsorry for wasting your time with such nonsense. I'm going to drop it in\nthe next re-roll.\n"}]}