{"thread":{"id":"42369","subject":"[PATCH 01/21] i18n: builtin/remote.c: fix mark for translation","startedAt":"2016-05-18T15:27:33Z","lastAt":"2016-05-23T01:00:37Z","messageCount":42,"participants":["Vasco Almeida","Eric Sunshine","Junio C Hamano","Ævar Arnfjörð Bjarmason"],"isPatch":true,"patchVersion":1,"patchTotal":21},"messages":[{"id":"286868","messageId":"1463585274-9027-1-git-send-email-vascomalmeida@sapo.pt","threadId":"42369","inReplyTo":null,"subject":"[PATCH 00/21] i18n and tests updates","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-18T15:27:33Z","receivedAt":"2016-05-18T15:27:33Z","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\nVasco Almeida (21):\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  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\n Makefile                             |   5 +-\n advice.c                             |  21 ++-\n builtin/pull.c                       |   2 +-\n builtin/remote.c                     |   6 +-\n git-bisect.sh                        |   5 +-\n git-merge-octopus.sh                 |  24 ++--\n git-rebase--interactive.sh           | 270 +++++++++++++++++++++--------------\n git-rebase.sh                        |   4 +-\n git-sh-i18n.sh                       |   4 +\n git-sh-setup.sh                      |  56 ++++++--\n sequencer.c                          |  13 +-\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               |   2 +-\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/t3400-rebase.sh                    |   4 +-\n t/t3404-rebase-interactive.sh        |  18 +--\n t/t4153-am-resume-override-opts.sh   |   2 +-\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          |   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 t/t7607-merge-overwrite.sh           |   2 +-\n t/t9003-help-autocorrect.sh          |   8 +-\n transport.c                          |  20 +--\n 42 files changed, 337 insertions(+), 226 deletions(-)\n\n-- \n2.7.3\n"},{"id":"286866","messageId":"1463585274-9027-2-git-send-email-vascomalmeida@sapo.pt","threadId":"42369","inReplyTo":"1463585274-9027-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH 01/21] i18n: builtin/remote.c: fix mark for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-18T15:27:34Z","receivedAt":"2016-05-18T15:27:34Z","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":"286867","messageId":"1463585274-9027-3-git-send-email-vascomalmeida@sapo.pt","threadId":"42369","inReplyTo":"1463585274-9027-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH 02/21] i18n: advice: mark string about detached head for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-18T15:27:35Z","receivedAt":"2016-05-18T15:27:35Z","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\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n advice.c | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/advice.c b/advice.c\nindex 4dc5cf1..703a847 100644\n--- a/advice.c\n+++ b/advice.c\n@@ -107,13 +107,13 @@ void NORETURN die_conclude_merge(void)\n void detach_advice(const char *new_name)\n {\n \tconst char fmt[] =\n-\t\"Note: checking out '%s'.\\n\\n\"\n+\tN_(\"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 }\n-- \n2.7.3\n"},{"id":"286870","messageId":"1463585274-9027-4-git-send-email-vascomalmeida@sapo.pt","threadId":"42369","inReplyTo":"1463585274-9027-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH 03/21] i18n: advice: internationalize message for conflicts","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-18T15:27:36Z","receivedAt":"2016-05-18T15:27:36Z","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 messages.\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 703a847..bc531fc 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-pick is not possible because you have unmerged files.\"));\n+\telse if (!strcmp(me, \"commit\"))\n+\t\terror(_(\"commit is not possible because you have unmerged files.\"));\n+\telse if (!strcmp(me, \"merge\"))\n+\t\terror(_(\"merge is not possible because you have unmerged files.\"));\n+\telse if (!strcmp(me, \"pull\"))\n+\t\terror(_(\"pull is not possible because you have unmerged files.\"));\n+\telse if (!strcmp(me, \"revert\"))\n+\t\terror(_(\"revert is not possible because you have unmerged files.\"));\n+\telse\n+\t\terror(_(\"%s is not possible 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..61beff6 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 \"pull 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":"286869","messageId":"1463585274-9027-5-git-send-email-vascomalmeida@sapo.pt","threadId":"42369","inReplyTo":"1463585274-9027-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH 04/21] i18n: transport: mark strings for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-18T15:27:37Z","receivedAt":"2016-05-18T15:27:37Z","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":"286871","messageId":"1463585274-9027-6-git-send-email-vascomalmeida@sapo.pt","threadId":"42369","inReplyTo":"1463585274-9027-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH 05/21] i18n: sequencer: mark entire sentences for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-18T15:27:38Z","receivedAt":"2016-05-18T15:27:38Z","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\"). That would facilitate\ntranslation work.\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":"286872","messageId":"1463585274-9027-7-git-send-email-vascomalmeida@sapo.pt","threadId":"42369","inReplyTo":"1463585274-9027-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH 06/21] i18n: sequencer: mark string for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-18T15:27:39Z","receivedAt":"2016-05-18T15:27:39Z","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":"286875","messageId":"1463585274-9027-8-git-send-email-vascomalmeida@sapo.pt","threadId":"42369","inReplyTo":"1463585274-9027-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH 07/21] i18n: merge-octopus: mark messages for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-18T15:27:40Z","receivedAt":"2016-05-18T15:27:40Z","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":"286873","messageId":"1463585274-9027-9-git-send-email-vascomalmeida@sapo.pt","threadId":"42369","inReplyTo":"1463585274-9027-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH 08/21] merge-octupus: use die shell function from git-sh-setup.sh","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-18T15:27:41Z","receivedAt":"2016-05-18T15:27:41Z","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":"286874","messageId":"1463585274-9027-10-git-send-email-vascomalmeida@sapo.pt","threadId":"42369","inReplyTo":"1463585274-9027-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH 09/21] i18n: rebase: fix marked string to use eval_gettext variant","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-18T15:27:42Z","receivedAt":"2016-05-18T15:27:42Z","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":"286876","messageId":"1463585274-9027-11-git-send-email-vascomalmeida@sapo.pt","threadId":"42369","inReplyTo":"1463585274-9027-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH 10/21] i18n: rebase: mark placeholder for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-18T15:27:43Z","receivedAt":"2016-05-18T15:27:43Z","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":"286878","messageId":"1463585274-9027-12-git-send-email-vascomalmeida@sapo.pt","threadId":"42369","inReplyTo":"1463585274-9027-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH 11/21] i18n: bisect: simplify error message for i18n","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-18T15:27:44Z","receivedAt":"2016-05-18T15:27:44Z","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/gettext.html#Preparing-Shell-Scripts\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":"286877","messageId":"1463585274-9027-13-git-send-email-vascomalmeida@sapo.pt","threadId":"42369","inReplyTo":"1463585274-9027-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH 12/21] t6030: update to use test_i18ncmp","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-18T15:27:45Z","receivedAt":"2016-05-18T15:27:45Z","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":"286879","messageId":"1463585274-9027-14-git-send-email-vascomalmeida@sapo.pt","threadId":"42369","inReplyTo":"1463585274-9027-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH 13/21] i18n: git-sh-setup.sh: mark strings for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-18T15:27:46Z","receivedAt":"2016-05-18T15:27:46Z","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\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\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n Makefile        |  4 +++-\n git-sh-setup.sh | 56 ++++++++++++++++++++++++++++++++++++++++++--------------\n 2 files changed, 45 insertions(+), 15 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex bc3d41e..d31fcf2 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..55efa23 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,48 +186,72 @@ 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 \n require_work_tree_exists () {\n+\tprogram_name=$0\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\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-\tdie \"fatal: $0 cannot be used without a working tree.\"\n+\t\tdie \"$(gettext \"fatal: \\$program_name cannot be used without a working tree.\")\"\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\techo >&2 \"Cannot $1: You have unstaged changes.\"\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\"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\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 \"$hint\" && echo \"$2\" >&2\n \t\texit 1\n \tfi\n }\n@@ -336,12 +364,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":"286881","messageId":"1463585274-9027-15-git-send-email-vascomalmeida@sapo.pt","threadId":"42369","inReplyTo":"1463585274-9027-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH 14/21] i18n: rebase-interactive: mark strings for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-18T15:27:47Z","receivedAt":"2016-05-18T15:27:47Z","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\nenabled 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 | 171 ++++++++++++++++++++++++---------------------\n 2 files changed, 92 insertions(+), 80 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex d31fcf2..c22c6f2 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 1c6dfb6..5ce5b1f 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\tprintf \"$(gettext Rebasing) (%d/%d)\\r\" $new_count $total\n \t\ttest -z \"$verbose\" || echo\n \tfi\n }\n@@ -201,11 +201,13 @@ 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+\t# TRANSLATORS: after this line is a command to be issued by the user\n+\twarn \"$(gettext \"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+\t# TRANSLATORS: after this line is a command to be issued by the user\n+\twarn \"$(gettext \"Once you are satisfied with your changes, run\")\"\n \twarn\n \twarn \"\tgit rebase --continue\"\n \twarn\n@@ -222,9 +224,10 @@ 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+\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 \ttest \"$tree\" = \"$ptree\"\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\tprintf \"$(gettext Executing:) %s\\n\" \"$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,11 +623,12 @@ 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 \"$(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\t# TRANSLATORS: after this line is a command to be issued by the user\n+\t\t\twarn \"$(gettext \"You can fix the problem, and then run\")\"\n \t\t\twarn\n \t\t\twarn \"\tgit rebase --continue\"\n \t\t\twarn\n@@ -630,9 +639,11 @@ 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\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 \t\t\twarn\n \t\t\twarn \"\tgit rebase --continue\"\n \t\t\twarn\n@@ -640,8 +651,8 @@ do_next () {\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 \"$(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":"286885","messageId":"1463585274-9027-16-git-send-email-vascomalmeida@sapo.pt","threadId":"42369","inReplyTo":"1463585274-9027-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH 15/21] i18n: rebase-interactive: mark here-doc strings for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-18T15:27:48Z","receivedAt":"2016-05-18T15:27:48Z","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 dummy function to be called by tests when running\nunder GETTEXT_POISON. Otherwise, tests would fail under gettext poison\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                |  4 ++++\n t/t3404-rebase-interactive.sh | 14 +++++++-------\n 3 files changed, 26 insertions(+), 22 deletions(-)\n\ndiff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh\nindex 5ce5b1f..933fcd2 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..c14c303 100644\n--- a/git-sh-i18n.sh\n+++ b/git-sh-i18n.sh\n@@ -64,6 +64,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 () {\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":"286880","messageId":"1463585274-9027-17-git-send-email-vascomalmeida@sapo.pt","threadId":"42369","inReplyTo":"1463585274-9027-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH 16/21] i18n: rebase-interactive: mark comments of squash for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-18T15:27:49Z","receivedAt":"2016-05-18T15:27:49Z","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 933fcd2..b04389b 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":"286884","messageId":"1463585274-9027-18-git-send-email-vascomalmeida@sapo.pt","threadId":"42369","inReplyTo":"1463585274-9027-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH 17/21] tests: use test_i18n* functions to suppress false positives","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-18T15:27:50Z","receivedAt":"2016-05-18T15:27:50Z","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            |  2 +-\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(+), 41 deletions(-)\n\ndiff --git a/t/t0008-ignores.sh b/t/t0008-ignores.sh\nindex 89544dd..43aa2bd 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..4079fef 100755\n--- a/t/t1307-config-blob.sh\n+++ b/t/t1307-config-blob.sh\n@@ -64,7 +64,7 @@ test_expect_success 'parse errors in blobs are properly attributed' '\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":"286883","messageId":"1463585274-9027-19-git-send-email-vascomalmeida@sapo.pt","threadId":"42369","inReplyTo":"1463585274-9027-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH 18/21] tests: unpack-trees: update to use test_i18n* functions","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-18T15:27:51Z","receivedAt":"2016-05-18T15:27:51Z","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":"286882","messageId":"1463585274-9027-20-git-send-email-vascomalmeida@sapo.pt","threadId":"42369","inReplyTo":"1463585274-9027-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH 19/21] t9003: become resilient to GETTEXT_POISON","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-18T15:27:52Z","receivedAt":"2016-05-18T15:27:52Z","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 | 8 ++++++--\n 1 file changed, 6 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t9003-help-autocorrect.sh b/t/t9003-help-autocorrect.sh\nindex dfe95c9..f6f6c92 100755\n--- a/t/t9003-help-autocorrect.sh\n+++ b/t/t9003-help-autocorrect.sh\n@@ -31,10 +31,14 @@ 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+\tsed -e \"1,/^Did you mean this/d\" actual |\n+\tsed -e \"/GETTEXT POISON/d\" actual |\n+\tgrep lgf &&\n \n \ttest_must_fail git distimdist 2>actual &&\n-\tsed -e \"1,/^Did you mean this/d\" actual | grep distimdistim\n+\tsed -e \"1,/^Did you mean this/d\" actual |\n+\tsed -e \"/GETTEXT POISON/d\" actual |\n+\tgrep distimdistim\n '\n \n test_expect_success 'autocorrect running commands' '\n-- \n2.7.3\n"},{"id":"286887","messageId":"1463585274-9027-21-git-send-email-vascomalmeida@sapo.pt","threadId":"42369","inReplyTo":"1463585274-9027-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH 20/21] t4153: fix negated test_i18ngrep call","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-18T15:27:53Z","receivedAt":"2016-05-18T15:27:53Z","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":"286886","messageId":"1463585274-9027-22-git-send-email-vascomalmeida@sapo.pt","threadId":"42369","inReplyTo":"1463585274-9027-1-git-send-email-vascomalmeida@sapo.pt","subject":"[PATCH 21/21] t5523: use test_i18ngrep for negation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-18T15:27:54Z","receivedAt":"2016-05-18T15:27:54Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Replace the first form by the second one:\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":"286916","messageId":"CAPig+cTgQmJG5a8dNjkYcNPG_vEHycyi19sHkO_yO-EfFQzy5A@mail.gmail.com","threadId":"42369","inReplyTo":"1463585274-9027-4-git-send-email-vascomalmeida@sapo.pt","subject":"Re: [PATCH 03/21] i18n: advice: internationalize message for conflicts","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2016-05-18T19:24:57Z","receivedAt":"2016-05-18T19:24:57Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Wed, May 18, 2016 at 11:27 AM, Vasco Almeida <vascomalmeida@sapo.pt> wrote:\n> Mark message for translation telling the user she has conflicts to\n> resolve. Expose each particular use case, in order to enable translating\n> entire sentences which would facilitate translating into other\n> languages.\n>\n> Change \"Pull\" to lowercase to match other messages.\n>\n> Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n> ---\n> diff --git a/advice.c b/advice.c\n> @@ -79,7 +79,20 @@ int git_default_advice_config(const char *var, const char *value)\n>  int error_resolve_conflict(const char *me)\n>  {\n> -       error(\"%s is not possible because you have unmerged files.\", me);\n> +       if (!strcmp(me, \"cherry-pick\"))\n> +               error(_(\"cherry-pick is not possible because you have unmerged files.\"));\n> +       else if (!strcmp(me, \"commit\"))\n> +               error(_(\"commit is not possible because you have unmerged files.\"));\n> +       else if (!strcmp(me, \"merge\"))\n> +               error(_(\"merge is not possible because you have unmerged files.\"));\n> +       else if (!strcmp(me, \"pull\"))\n> +               error(_(\"pull is not possible because you have unmerged files.\"));\n> +       else if (!strcmp(me, \"revert\"))\n> +               error(_(\"revert is not possible because you have unmerged files.\"));\n> +       else\n> +               error(_(\"%s is not possible because you have unmerged files.\"),\n> +                       me);\n\nDespite the commit message, I still don't understand this change. 'me'\nis a literal git command which shouldn't be translated, so how is this\nhelping?\n"},{"id":"286917","messageId":"CAPig+cQzsxMMv1XSdStFDs08C3qvb_Ttb4oVeN3T1si85v=f7w@mail.gmail.com","threadId":"42369","inReplyTo":"1463585274-9027-6-git-send-email-vascomalmeida@sapo.pt","subject":"Re: [PATCH 05/21] i18n: sequencer: mark entire sentences for translation","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2016-05-18T19:28:57Z","receivedAt":"2016-05-18T19:28:57Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Wed, May 18, 2016 at 11:27 AM, Vasco Almeida <vascomalmeida@sapo.pt> wrote:\n> Mark entire sentences of error message rather than assembling one using\n> placeholders (e.g. \"Cannot %s during a %s\"). That would facilitate\n> translation work.\n>\n> Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n> ---\n> diff --git a/sequencer.c b/sequencer.c\n> @@ -697,9 +697,14 @@ static struct commit *parse_insn_line(char *bol, char *eol, struct replay_opts *\n>         if (action != opts->action) {\n> -               const char *action_str;\n> -               action_str = action == REPLAY_REVERT ? \"revert\" : \"cherry-pick\";\n> -               error(_(\"Cannot %s during a %s\"), action_str, action_name(opts));\n> +               if (action == REPLAY_REVERT)\n> +                     error((opts->action == REPLAY_REVERT)\n> +                           ? _(\"Cannot revert during a another revert.\")\n> +                           : _(\"Cannot revert during a cherry-pick.\"));\n> +               else\n> +                     error((opts->action == REPLAY_REVERT)\n> +                           ? _(\"Cannot cherry-pick during a revert.\")\n> +                           : _(\"Cannot cherry-pick during another cherry-pick.\"));\n>                 return NULL;\n>         }\n\nSimilar to my comment on patch 3/21, since the \"actions\" are literal\ngit commands, it's not clear why this change is helpful. Perhaps the\ncommit message needs to do a better job of persuading the reader?\n"},{"id":"286928","messageId":"573CD7EC.9060606@sapo.pt","threadId":"42369","inReplyTo":"CAPig+cTgQmJG5a8dNjkYcNPG_vEHycyi19sHkO_yO-EfFQzy5A@mail.gmail.com","subject":"Re: [PATCH 03/21] i18n: advice: internationalize message for conflicts","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-18T21:00:28Z","receivedAt":"2016-05-18T21:00:28Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Às 19:24 de 18-05-2016, Eric Sunshine escreveu:\n> On Wed, May 18, 2016 at 11:27 AM, Vasco Almeida <vascomalmeida@sapo.pt> wrote:\n>> Mark message for translation telling the user she has conflicts to\n>> resolve. Expose each particular use case, in order to enable translating\n>> entire sentences which would facilitate translating into other\n>> languages.\n>>\n>> Change \"Pull\" to lowercase to match other messages.\n>>\n>> Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n>> ---\n>> diff --git a/advice.c b/advice.c\n>> @@ -79,7 +79,20 @@ int git_default_advice_config(const char *var, const char *value)\n>>  int error_resolve_conflict(const char *me)\n>>  {\n>> -       error(\"%s is not possible because you have unmerged files.\", me);\n>> +       if (!strcmp(me, \"cherry-pick\"))\n>> +               error(_(\"cherry-pick is not possible because you have unmerged files.\"));\n>> +       else if (!strcmp(me, \"commit\"))\n>> +               error(_(\"commit is not possible because you have unmerged files.\"));\n>> +       else if (!strcmp(me, \"merge\"))\n>> +               error(_(\"merge is not possible because you have unmerged files.\"));\n>> +       else if (!strcmp(me, \"pull\"))\n>> +               error(_(\"pull is not possible because you have unmerged files.\"));\n>> +       else if (!strcmp(me, \"revert\"))\n>> +               error(_(\"revert is not possible because you have unmerged files.\"));\n>> +       else\n>> +               error(_(\"%s is not possible because you have unmerged files.\"),\n>> +                       me);\n> \n> Despite the commit message, I still don't understand this change. 'me'\n> is a literal git command which shouldn't be translated, so how is this\n> helping?\n> \nI saw it as an operation that could be translated, not necessary a git\ncommand - just happens to be so. Now that you mention, I can see this\npatch doesn't had much value from that point of view.\n\nOn the other hand, I can translate the sentence, including the command\nname. Something I couldn't before and I would likely do it to be\nconsistent with other translations I've done and also because, as a\nuser, I would like to read the entire sentence in my language.\n\nI have few experience in i18n and l10n, but often I realize I'm making\nassumptions about other languages that are not true. Some translations,\nsay Chinese or Bulgarian that have their own writing systems, might\ntranslate that command word to something to their writing. Others might\nagglutinate the command word with some suffix.\nI can't say for sure because I don't know those languages, but it's\npossible.\n\nMaybe the first paragraph can give you a better understanding of the issue:\nhttp://www.gnu.org/software/gettext/manual/html_node/Names.html\n"},{"id":"286930","messageId":"573CD84F.7000207@sapo.pt","threadId":"42369","inReplyTo":"CAPig+cQzsxMMv1XSdStFDs08C3qvb_Ttb4oVeN3T1si85v=f7w@mail.gmail.com","subject":"Re: [PATCH 05/21] i18n: sequencer: mark entire sentences for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-18T21:02:07Z","receivedAt":"2016-05-18T21:02:07Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Às 19:28 de 18-05-2016, Eric Sunshine escreveu:\n> On Wed, May 18, 2016 at 11:27 AM, Vasco Almeida <vascomalmeida@sapo.pt> wrote:\n>> Mark entire sentences of error message rather than assembling one using\n>> placeholders (e.g. \"Cannot %s during a %s\"). That would facilitate\n>> translation work.\n>>\n>> Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n>> ---\n>> diff --git a/sequencer.c b/sequencer.c\n>> @@ -697,9 +697,14 @@ static struct commit *parse_insn_line(char *bol, char *eol, struct replay_opts *\n>>         if (action != opts->action) {\n>> -               const char *action_str;\n>> -               action_str = action == REPLAY_REVERT ? \"revert\" : \"cherry-pick\";\n>> -               error(_(\"Cannot %s during a %s\"), action_str, action_name(opts));\n>> +               if (action == REPLAY_REVERT)\n>> +                     error((opts->action == REPLAY_REVERT)\n>> +                           ? _(\"Cannot revert during a another revert.\")\n>> +                           : _(\"Cannot revert during a cherry-pick.\"));\n>> +               else\n>> +                     error((opts->action == REPLAY_REVERT)\n>> +                           ? _(\"Cannot cherry-pick during a revert.\")\n>> +                           : _(\"Cannot cherry-pick during another cherry-pick.\"));\n>>                 return NULL;\n>>         }\n> \n> Similar to my comment on patch 3/21, since the \"actions\" are literal\n> git commands, it's not clear why this change is helpful. Perhaps the\n> commit message needs to do a better job of persuading the reader?\n> \nI agree, I should have explained why this way. As I tried to explain on\npatch 3/21, it concerns a) we can't assume what and how does the\ntranslator translates into her language, so b) give translations freedom\nto choose.\n"},{"id":"286933","messageId":"xmqqd1ojqciz.fsf@gitster.mtv.corp.google.com","threadId":"42369","inReplyTo":"573CD7EC.9060606@sapo.pt","subject":"Re: [PATCH 03/21] i18n: advice: internationalize message for conflicts","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-05-18T21:31:00Z","receivedAt":"2016-05-18T21:31:00Z","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>>> +       else\n>>> +               error(_(\"%s is not possible because you have unmerged files.\"),\n>>> +                       me);\n>> \n>> Despite the commit message, I still don't understand this change. 'me'\n>> is a literal git command which shouldn't be translated, so how is this\n>> helping?\n>> \n> I saw it as an operation that could be translated, not necessary a git\n> command\n\nThe intention of who wrote this message was to tell this to the\nuser:\n\n    Running the command '$X' is not possible in this situation.\n\nimplying \"Don't type '$X' again; it is futile.  Correct the unmerged\nstatus first\".\n\nOur subcommand names are English verbs, because they are designed to\nbe easily understandable by English speakers, so we do not exactly\nsay \"Running the command 'commit'\" in the message.  Instead we say\n\"commit is not possible...\" for brevity.\n\nLanguages, if their grammatical rules do not allow a subcommand name\nin the place in a straight-translation of that original sentence,\nare allowed to (and encouraged to) translate the original \"%s is not\npossible\" as if it were \"Running the command '%s' is not possible\".\nThat is what good translaters would do anyway.\n\nSo for this (and 05/21 for the same reasons), I do not think we want\nto split and duplicate the messages.\n"},{"id":"287003","messageId":"CAPig+cRWn+6B-+ZLEX03okOSt76iww1vzP+e_FoQZVHarCrW_Q@mail.gmail.com","threadId":"42369","inReplyTo":"1463585274-9027-15-git-send-email-vascomalmeida@sapo.pt","subject":"Re: [PATCH 14/21] i18n: rebase-interactive: mark strings for translation","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2016-05-19T17:49:45Z","receivedAt":"2016-05-19T17:49:45Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Wed, May 18, 2016 at 11:27 AM, Vasco Almeida <vascomalmeida@sapo.pt> wrote:\n> Mark strings in git-rebase--interactive.sh for translation. There is no\n> need to source git-sh-i18n since git-rebase.sh already does so.\n>\n> Add git-rebase--interactive.sh to LOCALIZED_SH in Makefile in order to\n> enabled extracting strings marked for translation by xgettext.\n\ns/enabled/enable/\n\n> Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n"},{"id":"287009","messageId":"CAPig+cT3yf7D4xOmOhy5Y21qwHuA5Ny9ULEJhC1OBgrhiayQ3g@mail.gmail.com","threadId":"42369","inReplyTo":"1463585274-9027-20-git-send-email-vascomalmeida@sapo.pt","subject":"Re: [PATCH 19/21] t9003: become resilient to GETTEXT_POISON","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2016-05-19T18:34:29Z","receivedAt":"2016-05-19T18:34:29Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Wed, May 18, 2016 at 11:27 AM, Vasco Almeida <vascomalmeida@sapo.pt> wrote:\n> The test t9003-help-autocorrect.sh fails when run under GETTEXT_POISON,\n> because it's expecting to filter out the original output. Accommodate\n> gettext poison case by also filtering out the default simulated output.\n>\n> Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n> ---\n> diff --git a/t/t9003-help-autocorrect.sh b/t/t9003-help-autocorrect.sh\n> @@ -31,10 +31,14 @@ test_expect_success 'autocorrect showing candidates' '\n>         git config help.autocorrect 0 &&\n>\n>         test_must_fail git lfg 2>actual &&\n> -       sed -e \"1,/^Did you mean this/d\" actual | grep lgf &&\n> +       sed -e \"1,/^Did you mean this/d\" actual |\n> +       sed -e \"/GETTEXT POISON/d\" actual |\n\nWhy not do so with a single sed invocation?\n\n   sed -e \"...\" -e \"...\" |\n\n> +       grep lgf &&\n>\n>         test_must_fail git distimdist 2>actual &&\n> -       sed -e \"1,/^Did you mean this/d\" actual | grep distimdistim\n> +       sed -e \"1,/^Did you mean this/d\" actual |\n> +       sed -e \"/GETTEXT POISON/d\" actual |\n\nDitto.\n\n> +       grep distimdistim\n>  '\n"},{"id":"287025","messageId":"573E30C8.4070600@sapo.pt","threadId":"42369","inReplyTo":"CAPig+cT3yf7D4xOmOhy5Y21qwHuA5Ny9ULEJhC1OBgrhiayQ3g@mail.gmail.com","subject":"Re: [PATCH 19/21] t9003: become resilient to GETTEXT_POISON","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-19T21:31:52Z","receivedAt":"2016-05-19T21:31:52Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Às 18:34 de 19-05-2016, Eric Sunshine escreveu:\n> On Wed, May 18, 2016 at 11:27 AM, Vasco Almeida <vascomalmeida@sapo.pt> wrote:\n>> The test t9003-help-autocorrect.sh fails when run under GETTEXT_POISON,\n>> because it's expecting to filter out the original output. Accommodate\n>> gettext poison case by also filtering out the default simulated output.\n>>\n>> Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n>> ---\n>> diff --git a/t/t9003-help-autocorrect.sh b/t/t9003-help-autocorrect.sh\n>> @@ -31,10 +31,14 @@ test_expect_success 'autocorrect showing candidates' '\n>>         git config help.autocorrect 0 &&\n>>\n>>         test_must_fail git lfg 2>actual &&\n>> -       sed -e \"1,/^Did you mean this/d\" actual | grep lgf &&\n>> +       sed -e \"1,/^Did you mean this/d\" actual |\n>> +       sed -e \"/GETTEXT POISON/d\" actual |\n> \n> Why not do so with a single sed invocation?\n> \n>    sed -e \"...\" -e \"...\" |\n> \n>> +       grep lgf &&\n>>\n>>         test_must_fail git distimdist 2>actual &&\n>> -       sed -e \"1,/^Did you mean this/d\" actual | grep distimdistim\n>> +       sed -e \"1,/^Did you mean this/d\" actual |\n>> +       sed -e \"/GETTEXT POISON/d\" actual |\n> \n> Ditto.\n> \n>> +       grep distimdistim\n>>  '\n\nI tried but it seems not to work.\n\nActually I did this wrong, I haven't thought this through.\n\nUnder gettext poison:\nsed -e \"1,/^Did you mean this/d\" removes all lines, gives no output.\nAnd then the one second, sed -e \"/GETTEXT POISON/d\", outputs \"lgf\" as\nexpected.\n\nBut running normally (without gettext poison):\n1st sed outputs \"lgf\" as expected\nAnd then second one output the entire 'actual' file, like if it were\ncat, undoing the first sed.\n\nI think the sed here is superfluous in the first place.\nShould we remove it? If it weren't the case of gettext poison it was ok\nto have sed there, but it makes the test fail under gettext poison.\n"},{"id":"287057","messageId":"CAPig+cRo3tjt9N0YO8sNn90dL3dP0asfmKTr5rerS9YLO6QBtw@mail.gmail.com","threadId":"42369","inReplyTo":"573E30C8.4070600@sapo.pt","subject":"Re: [PATCH 19/21] t9003: become resilient to GETTEXT_POISON","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2016-05-20T03:30:19Z","receivedAt":"2016-05-20T03:30:19Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"[cc:+junio]\n\nOn Thu, May 19, 2016 at 5:31 PM, Vasco Almeida <vascomalmeida@sapo.pt> wrote:\n> Às 18:34 de 19-05-2016, Eric Sunshine escreveu:\n>> On Wed, May 18, 2016 at 11:27 AM, Vasco Almeida <vascomalmeida@sapo.pt> wrote:\n>>> -       sed -e \"1,/^Did you mean this/d\" actual | grep lgf &&\n>>> +       sed -e \"1,/^Did you mean this/d\" actual |\n>>> +       sed -e \"/GETTEXT POISON/d\" actual |\n>>> +       grep distimdistim\n>>\n>> Why not do so with a single sed invocation?\n>>\n>>    sed -e \"...\" -e \"...\" |\n>\n> I tried but it seems not to work.\n>\n> Actually I did this wrong, I haven't thought this through.\n>\n> Under gettext poison:\n> sed -e \"1,/^Did you mean this/d\" removes all lines, gives no output.\n> And then the one second, sed -e \"/GETTEXT POISON/d\", outputs \"lgf\" as\n> expected.\n>\n> But running normally (without gettext poison):\n> 1st sed outputs \"lgf\" as expected\n> And then second one output the entire 'actual' file, like if it were\n> cat, undoing the first sed.\n>\n> I think the sed here is superfluous in the first place.\n> Should we remove it? If it weren't the case of gettext poison it was ok\n> to have sed there, but it makes the test fail under gettext poison.\n\nIndeed, the sed seems superfluous. The output of the test command is:\n\n    git: 'lfg' is not a git command. See 'git --help'.\n\n    Did you mean this?\n        lgf\n\nAnd, the grep'd string, \"lgf\" only appears once, so grep alone should\nbe sufficient to verify expected behavior. Likewise for the other case\nof misspelled \"distimdist\" and grep'd \"distimdistim\" which appears\nonly once.\n\nI agree that the simplest fix to make GETTEXT_POISON work is to drop\nthe sed invocation.\n\nAnyhow, I've cc:'d the author of 9d1d2b7 (git: remove an early return\nfrom save_env_before_alias(), 2016-01-26) which introduced it.\n"},{"id":"287105","messageId":"xmqqbn40fzu8.fsf@gitster.mtv.corp.google.com","threadId":"42369","inReplyTo":"CAPig+cRo3tjt9N0YO8sNn90dL3dP0asfmKTr5rerS9YLO6QBtw@mail.gmail.com","subject":"Re: [PATCH 19/21] t9003: become resilient to GETTEXT_POISON","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-05-20T16:39:43Z","receivedAt":"2016-05-20T16:39:43Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Eric Sunshine <sunshine@sunshineco.com> writes:\n\n> [cc:+junio]\n>\n> Indeed, the sed seems superfluous. The output of the test command is:\n>\n>     git: 'lfg' is not a git command. See 'git --help'.\n>\n>     Did you mean this?\n>         lgf\n>\n> And, the grep'd string, \"lgf\" only appears once, so grep alone should\n> be sufficient to verify expected behavior.\n\nWe want to see the string appear after \"Did you mean this?\" and we\ndo not want to be fooled by a future change in the early part of the\nmessage, which may contain a substring l-g-f that does not have\nanything to do with the alias we are looking for.\n\nAnd the way you express \"I do not care anything above this line\" is\nto say \"sed -e '1,/^that line/d'\".\n\nOf course, if you use this with POISON, you'd need to consider that\n\"Did you mean this\" would not be a good marker to identify where the\nintroductory text we want to ignore ends.  You'd need to find a\ndifferent mechanism to exclude the introductory text if you want to\nretain the future-proofing the existing \"sed -e\" gave us.\n\nPerhaps discarding up to the first blank line (i.e. assuming that we\nwould not remove that blank, and also assuming that we will not\nrephrase \"Did you mean this?\") may be a good alternative.\n\nOr assuming that the explanatory text would not begin its lines with\na tab, i.e.\n\n\tgrep '^\tlgf$' actual\n\n(the space between '^' and 'l' above is a TAB) without using\ntest_i18ngrep?\n\nI think I like that the best among what I can think of offhand.\n"},{"id":"287111","messageId":"CAPig+cSxK0q_0AvB=npwpcWuMugg7QH9roQuK9kXyy=UK69rww@mail.gmail.com","threadId":"42369","inReplyTo":"xmqqbn40fzu8.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH 19/21] t9003: become resilient to GETTEXT_POISON","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2016-05-20T17:22:45Z","receivedAt":"2016-05-20T17:22:45Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Fri, May 20, 2016 at 12:39 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Eric Sunshine <sunshine@sunshineco.com> writes:\n>> Indeed, the sed seems superfluous. The output of the test command is:\n>>\n>>     git: 'lfg' is not a git command. See 'git --help'.\n>>\n>>     Did you mean this?\n>>         lgf\n>>\n>> And, the grep'd string, \"lgf\" only appears once, so grep alone should\n>> be sufficient to verify expected behavior.\n>\n> Perhaps discarding up to the first blank line (i.e. assuming that we\n> would not remove that blank, and also assuming that we will not\n> rephrase \"Did you mean this?\") may be a good alternative.\n>\n> Or assuming that the explanatory text would not begin its lines with\n> a tab, i.e.\n>\n>         grep '^ lgf$' actual\n>\n> (the space between '^' and 'l' above is a TAB) without using\n> test_i18ngrep?\n>\n> I think I like that the best among what I can think of offhand.\n\nYep, I also considered both of these approaches and favored the latter, as well.\n"},{"id":"287112","messageId":"573F4BEC.7000906@sapo.pt","threadId":"42369","inReplyTo":"xmqqbn40fzu8.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH 19/21] t9003: become resilient to GETTEXT_POISON","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-20T17:39:56Z","receivedAt":"2016-05-20T17:39:56Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Às 16:39 de 20-05-2016, Junio C Hamano escreveu:\n> We want to see the string appear after \"Did you mean this?\" and we\n> do not want to be fooled by a future change in the early part of the\n> message, which may contain a substring l-g-f that does not have\n> anything to do with the alias we are looking for.\n> \n> And the way you express \"I do not care anything above this line\" is\n> to say \"sed -e '1,/^that line/d'\".\n> \n> Of course, if you use this with POISON, you'd need to consider that\n> \"Did you mean this\" would not be a good marker to identify where the\n> introductory text we want to ignore ends.  You'd need to find a\n> different mechanism to exclude the introductory text if you want to\n> retain the future-proofing the existing \"sed -e\" gave us.\n> \n> Perhaps discarding up to the first blank line (i.e. assuming that we\n> would not remove that blank, and also assuming that we will not\n> rephrase \"Did you mean this?\") may be a good alternative.\n> \n> Or assuming that the explanatory text would not begin its lines with\n> a tab, i.e.\n> \n> \tgrep '^\tlgf$' actual\n> \n> (the space between '^' and 'l' above is a TAB) without using\n> test_i18ngrep?\n> \n> I think I like that the best among what I can think of offhand.\n> \n> \nAlternatively, we could leave sed alone as it were before this patch and\nuse test_i18ngrep instead of grep to fake success under GETTEXT_POISON.\nI think I prefer this way. What do you think?\n"},{"id":"287114","messageId":"xmqqoa80ei03.fsf@gitster.mtv.corp.google.com","threadId":"42369","inReplyTo":"573F4BEC.7000906@sapo.pt","subject":"Re: [PATCH 19/21] t9003: become resilient to GETTEXT_POISON","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-05-20T17:50:20Z","receivedAt":"2016-05-20T17:50:20Z","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> Alternatively, we could leave sed alone as it were before this patch and\n> use test_i18ngrep instead of grep to fake success under GETTEXT_POISON.\n> I think I prefer this way. What do you think?\n\nThat is equivalent to saying that \"we would translate 'lgf' to\nend-user's language\", which does not make much sense to me.\n\nWouldn't the introductory explanation, up to \"Did you mean this?\",\nbe the only thing that is translated?\n"},{"id":"287116","messageId":"xmqqh9dsehl6.fsf@gitster.mtv.corp.google.com","threadId":"42369","inReplyTo":"xmqqoa80ei03.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH 19/21] t9003: become resilient to GETTEXT_POISON","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-05-20T17:59:17Z","receivedAt":"2016-05-20T17:59:17Z","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> Vasco Almeida <vascomalmeida@sapo.pt> writes:\n>\n>> Alternatively, we could leave sed alone as it were before this patch and\n>> use test_i18ngrep instead of grep to fake success under GETTEXT_POISON.\n>> I think I prefer this way. What do you think?\n>\n> That is equivalent to saying that \"we would translate 'lgf' to\n> end-user's language\", which does not make much sense to me.\n>\n> Wouldn't the introductory explanation, up to \"Did you mean this?\",\n> be the only thing that is translated?\n\nI just checked the code ;-)  We do this:\n\n\tfprintf_ln(stderr,\n\t\t   Q_(\"\\nDid you mean this?\",\n\t\t      \"\\nDid you mean one of these?\",\n\t\t   n));\n\n\tfor (i = 0; i < n; i++)\n\t\tfprintf(stderr, \"\\t%s\\n\", main_cmds.names[i]->name);\n\nUsing test_i18ngrep would mean we would not be able to catch a\npotential future bug that does an equivalent of\n\n\tfor (i = 0; i < n; i++)\n\t\tfprintf(stderr, \"\\t%s\\n\", _(main_cmds.names[i]->name));\n\nin the loop, i.e. marking something that is not meant to be\ntranslated as translatable.\n\nAs long as translators do not translate \"Did you mean...\" to begin a\nline with a tab (which I do not think there is any reason to), it is\ngoing to work reliably to grep for \"^ lgf$\" here, and it will catch\nsuch a potential future bug under GETTEXT_POISON build.\n"},{"id":"287121","messageId":"573F55B3.4080603@sapo.pt","threadId":"42369","inReplyTo":"xmqqh9dsehl6.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH 19/21] t9003: become resilient to GETTEXT_POISON","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-20T18:21:39Z","receivedAt":"2016-05-20T18:21:39Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Às 17:59 de 20-05-2016, Junio C Hamano escreveu:\n> As long as translators do not translate \"Did you mean...\" to begin a\n> line with a tab (which I do not think there is any reason to), it is\n> going to work reliably to grep for \"^ lgf$\" here, and it will catch\n> such a potential future bug under GETTEXT_POISON build.\n\nTranslations don't affect the tests since they're run with C locale.\nI think all tests source test-lib.sh which does:\n\n\t# For repeatability, reset the environment to known value.\n\t# TERM is sanitized below, after saving color control sequences.\n\tLANG=C\n\tLC_ALL=C\n\tPAGER=cat\n\tTZ=UTC\n\texport LANG LC_ALL PAGER TZ\n\nSo, I'll remove sed command and use grep the way you said it, in the\nnext re-roll.\n"},{"id":"287149","messageId":"CACBZZX7T7b9xMM_mDcH6JBnuCap7RtKvSYoFNDrN5mLdmLLYHQ@mail.gmail.com","threadId":"42369","inReplyTo":"1463585274-9027-15-git-send-email-vascomalmeida@sapo.pt","subject":"Re: [PATCH 14/21] i18n: rebase-interactive: mark strings for translation","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2016-05-21T12:57:17Z","receivedAt":"2016-05-21T12:57:17Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"On Wed, May 18, 2016 at 5:27 PM, Vasco Almeida <vascomalmeida@sapo.pt> wrote:\n> Mark strings in git-rebase--interactive.sh for translation. There is no\n> need to source git-sh-i18n since git-rebase.sh already does so.\n\nCool, thanks for working on this.\n\n> --- a/git-rebase--interactive.sh\n> +++ b/git-rebase--interactive.sh\n> @@ -128,7 +128,7 @@ mark_action_done () {\n>         if test \"$last_count\" != \"$new_count\"\n>         then\n>                 last_count=$new_count\n> -               printf \"Rebasing (%d/%d)\\r\" $new_count $total\n> +               printf \"$(gettext Rebasing) (%d/%d)\\r\" $new_count $total\n>                 test -z \"$verbose\" || echo\n>         fi\n>  }\n\nThings like these should be converted into something you can pass to\neval_gettext. I.e. For any message the translator needs to be able to\ntranslate the whole message. Consider e.g. RTL languages where the\n(%d/%d) will be on the right-hand-side of the message.\n\n> @@ -201,11 +201,13 @@ exit_with_patch () {\n>         make_patch $1\n>         git rev-parse --verify HEAD > \"$amend\"\n>         gpg_sign_opt_quoted=${gpg_sign_opt:+$(git rev-parse --sq-quote \"$gpg_sign_opt\")}\n> -       warn \"You can amend the commit now, with\"\n> +       # TRANSLATORS: after this line is a command to be issued by the user\n> +       warn \"$(gettext \"You can amend the commit now, with\")\"\n>         warn\n>         warn \"  git commit --amend $gpg_sign_opt_quoted\"\n>         warn\n> -       warn \"Once you are satisfied with your changes, run\"\n> +       # TRANSLATORS: after this line is a command to be issued by the user\n> +       warn \"$(gettext \"Once you are satisfied with your changes, run\")\"\n>         warn\n>         warn \"  git rebase --continue\"\n>         warn\n\nStuff like this should be one big call to gettext. I.e. everything\nfrom \"You can amend\" up to and including \"--continue\". Even if the\ntranslators probably don't want to change the order here it helps a\nlot to have the extra context. I.e. do it like ...\n\n> @@ -536,10 +543,11 @@ do_next () {\n>                 mark_action_done\n>                 do_pick $sha1 \"$rest\"\n>                 git commit --amend --no-post-rewrite ${gpg_sign_opt:+\"$gpg_sign_opt\"} || {\n> -                       warn \"Could not amend commit after successfully picking $sha1... $rest\"\n> -                       warn \"This is most likely due to an empty commit message, or the pre-commit hook\"\n> -                       warn \"failed. If the pre-commit hook failed, you may need to resolve the issue before\"\n> -                       warn \"you are able to reword the commit.\"\n> +                       warn \"$(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>                         exit_with_patch $sha1 1\n>                 }\n\n... this! :)\n\n> @@ -607,7 +615,7 @@ do_next () {\n>         x|\"exec\")\n>                 read -r command rest < \"$todo\"\n>                 mark_action_done\n> -               printf 'Executing: %s\\n' \"$rest\"\n> +               printf \"$(gettext Executing:) %s\\n\" \"$rest\"\n>                 \"${SHELL:-@SHELL_PATH@}\" -c \"$rest\" # Actual execution\n>                 status=$?\n>                 # Run in subshell because require_clean_work_tree can die.\n\nDitto my first comment about the whole thing needing to be a call to\neval_gettext. I.e. also that \" %s\" part.\n\n> -                       warn \"You can fix the problem, and then run\"\n> +                       # TRANSLATORS: after this line is a command to be issued by the user\n> +                       warn \"$(gettext \"You can fix the problem, and then run\")\"\n>                         warn\n>                         warn \"  git rebase --continue\"\n>                         warn\n> @@ -630,9 +639,11 @@ do_next () {\n>                         exit \"$status\"\n>                 elif test \"$dirty\" = t\n>                 then\n> -                       warn \"Execution succeeded: $rest\"\n> -                       warn \"but left changes to the index and/or the working tree\"\n> -                       warn \"Commit or stash your changes, and then run\"\n> +                       # TRANSLATORS: after these lines is a command to be issued by the user\n> +                       warn \"$(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>                         warn\n>                         warn \"  git rebase --continue\"\n>                         warn\n\nBoth ditto the above. I.e. just include the command to be issued in\nthe message. Then you can also skip the TRANSLATORS comment since this\nwon't be confusing to them anymore.\n\n> @@ -991,28 +1002,26 @@ check_todo_list () {\n>                 then\n>                         test \"$check_level\" = error && raise_error=t\n>\n> -                       warn \"Warning: some commits may have been dropped\" \\\n> -                               \"accidentally.\"\n> -                       warn \"Dropped commits (newer to older):\"\n> +                       warn \"$(gettext \"\\\n> +Warning: some commits may have been dropped accidentally.\n> +Dropped commits (newer to older):\")\"\n>\n>                         # Make the list user-friendly and display\n>                         opt=\"--no-walk=sorted --format=oneline --abbrev-commit --stdin\"\n>                         git rev-list $opt <\"$todo\".miss | warn_lines\n>\n> -                       warn \"To avoid this message, use \\\"drop\\\" to\" \\\n> -                               \"explicitly remove a commit.\"\n> -                       warn\n> -                       warn \"Use 'git config rebase.missingCommitsCheck' to change\" \\\n> -                               \"the level of warnings.\"\n> -                       warn \"The possible behaviours are: ignore, warn, error.\"\n> +                       warn \"$(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>                         warn\n>                 fi\n>                 ;;\n>         ignore)\n>                 ;;\n>         *)\n\nMaking this into one big eval_gettext where we stash away those \"newer\nto older\" commits into a variable would be easier on translators, but\nmaybe there are performance considerations and we could just live with\ntwo messages. Not sure how large this list might get in practice.\n\nI haven't tried to apply & run this patch. But aside from the chunks I\ncommented on the rest of this looks fine to me.\n"},{"id":"287150","messageId":"CACBZZX790=CtGnryUNrc7S1rpV7D75MOnWnXqd=Smdkojx=ymw@mail.gmail.com","threadId":"42369","inReplyTo":"573CD84F.7000207@sapo.pt","subject":"Re: [PATCH 05/21] i18n: sequencer: mark entire sentences for translation","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2016-05-21T13:15:08Z","receivedAt":"2016-05-21T13:15:08Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"On Wed, May 18, 2016 at 11:02 PM, Vasco Almeida <vascomalmeida@sapo.pt> wrote:\n> Às 19:28 de 18-05-2016, Eric Sunshine escreveu:\n>> On Wed, May 18, 2016 at 11:27 AM, Vasco Almeida <vascomalmeida@sapo.pt> wrote:\n>>> Mark entire sentences of error message rather than assembling one using\n>>> placeholders (e.g. \"Cannot %s during a %s\"). That would facilitate\n>>> translation work.\n>>>\n>>> Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n>>> ---\n>>> diff --git a/sequencer.c b/sequencer.c\n>>> @@ -697,9 +697,14 @@ static struct commit *parse_insn_line(char *bol, char *eol, struct replay_opts *\n>>>         if (action != opts->action) {\n>>> -               const char *action_str;\n>>> -               action_str = action == REPLAY_REVERT ? \"revert\" : \"cherry-pick\";\n>>> -               error(_(\"Cannot %s during a %s\"), action_str, action_name(opts));\n>>> +               if (action == REPLAY_REVERT)\n>>> +                     error((opts->action == REPLAY_REVERT)\n>>> +                           ? _(\"Cannot revert during a another revert.\")\n>>> +                           : _(\"Cannot revert during a cherry-pick.\"));\n>>> +               else\n>>> +                     error((opts->action == REPLAY_REVERT)\n>>> +                           ? _(\"Cannot cherry-pick during a revert.\")\n>>> +                           : _(\"Cannot cherry-pick during another cherry-pick.\"));\n>>>                 return NULL;\n>>>         }\n>>\n>> Similar to my comment on patch 3/21, since the \"actions\" are literal\n>> git commands, it's not clear why this change is helpful. Perhaps the\n>> commit message needs to do a better job of persuading the reader?\n>>\n> I agree, I should have explained why this way. As I tried to explain on\n> patch 3/21, it concerns a) we can't assume what and how does the\n> translator translates into her language, so b) give translations freedom\n> to choose.\n\nFor what it's worth I agree with you and disagree with Eric here and\nJunio in the \"[PATCH 03/21] i18n: advice: internationalize message for\nconflicts\" thread.\n\nOf course there's a trade-off in source code verbosity when you have\nto change every occurance of (pseudocode):\n\n    \"our %s failed\" # %s can be revert or merge\n\nto:\n\n    if (action == \"merge\")\n        gettext(\"our merge failed\")\n    elsif (action == \"revert\")\n        gettext(\"our revert failed\")\n\nBut forcing the translator to turn every such occurrence that flows\nnaturally in English into \"the '%s' command failed\" leads to a worse\ntranslation.\n\nFor example, if I ever get around to doing the Icelandic translation\nwhich I've had on my backlog I might translate something like this:\n\n    \"You can merge or revert this commit\"\n    \"To merge run 'git merge $commit', to revert run 'git revert $commit'\"\n    # Subsequently\n    \"The %s failed\" # for %s = merge || revert\n\nAs:\n\n    \"Þú getur getur framkvæmt samruna á þessari breytingu, eða afturkallað hana\"\n    \"Til að framkvæma samruna keyrðu 'git merge $commit', til að\nafturkalla 'git revert $commit'\"\n    # Subsequently\n    \"Samruninn mistókst þegar við keyrðum 'merge' skipunina\".\n    \"Afturköllunnin mistókst þegar við keyrðum 'revert' skipunina\"\n\nI.e. even though you might be running \"git merge\" or \"git revert\" the\nUI is talking about those terms in the translated using native terms\nfor the action of merging or reverting, but referring to the literal\ncommand names in English.\n\nNot accepting changes like these means you have to translate this sort\nof stuff like:\n\n    # Same as the above\n    \"Þú getur getur framkvæmt samruna á þessari breytingu, eða\nafturkallað hana\".\n    \"Til að framkvæma samruna keyrðu 'git merge $commit', til að\nafturkalla 'git revert $commit'\"\n    # Subsequently\n    \"Okkur tókst ekki að keyra 'git %s' skipunina\" # %s = merge || revert\n\nIt just doesn't flow as well, and leads to a more verbose translation.\nNow instead of referring to the translated verb I'd already\nestablished I have to just refer to literal command names.\n\nBoth this change and the change you submitted in\n<1463585274-9027-4-git-send-email-vascomalmeida@sapo.pt> and Junio\ndidn't like in <xmqqd1ojqciz.fsf@gitster.mtv.corp.google.com> are\nactual examples of cases where if I was (finally getting of my ass to)\ndoing the Icelandic translation I'd take advantage of this.\n"},{"id":"287151","messageId":"57406B2E.7060206@sapo.pt","threadId":"42369","inReplyTo":"CACBZZX7T7b9xMM_mDcH6JBnuCap7RtKvSYoFNDrN5mLdmLLYHQ@mail.gmail.com","subject":"Re: [PATCH 14/21] i18n: rebase-interactive: mark strings for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-05-21T14:05:34Z","receivedAt":"2016-05-21T14:05:34Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Às 12:57 de 21-05-2016, Ævar Arnfjörð Bjarmason escreveu:\n> On Wed, May 18, 2016 at 5:27 PM, Vasco Almeida <vascomalmeida@sapo.pt> wrote:\n>> > Mark strings in git-rebase--interactive.sh for translation. There is no\n>> > need to source git-sh-i18n since git-rebase.sh already does so.\n> Cool, thanks for working on this.\n> \n>> > --- a/git-rebase--interactive.sh\n>> > +++ b/git-rebase--interactive.sh\n>> > @@ -128,7 +128,7 @@ mark_action_done () {\n>> >         if test \"$last_count\" != \"$new_count\"\n>> >         then\n>> >                 last_count=$new_count\n>> > -               printf \"Rebasing (%d/%d)\\r\" $new_count $total\n>> > +               printf \"$(gettext Rebasing) (%d/%d)\\r\" $new_count $total\n>> >                 test -z \"$verbose\" || echo\n>> >         fi\n>> >  }\n> Things like these should be converted into something you can pass to\n> eval_gettext. I.e. For any message the translator needs to be able to\n> translate the whole message. Consider e.g. RTL languages where the\n> (%d/%d) will be on the right-hand-side of the message.\n> \nOne more thing I haven't anticipated. Thank you for pointing it out.\n\nI'll take this and the other comments in consideration for the next re-roll.\n"},{"id":"287215","messageId":"xmqqk2ilbo2o.fsf@gitster.mtv.corp.google.com","threadId":"42369","inReplyTo":"CACBZZX790=CtGnryUNrc7S1rpV7D75MOnWnXqd=Smdkojx=ymw@mail.gmail.com","subject":"Re: [PATCH 05/21] i18n: sequencer: mark entire sentences for translation","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-05-23T00:44:15Z","receivedAt":"2016-05-23T00:44:15Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:\n\n> For what it's worth I agree with you and disagree with Eric here and\n> Junio in the \"[PATCH 03/21] i18n: advice: internationalize message for\n> conflicts\" thread.\n>\n> Of course there's a trade-off in source code verbosity when you have\n> to change every occurance of (pseudocode):\n>\n>     \"our %s failed\" # %s can be revert or merge\n>\n> to:\n>\n>     if (action == \"merge\")\n>         gettext(\"our merge failed\")\n>     elsif (action == \"revert\")\n>         gettext(\"our revert failed\")\n>\n> But forcing the translator to turn every such occurrence that flows\n> naturally in English into \"the '%s' command failed\" leads to a worse\n> translation.\n>\n> For example, if I ever get around to doing the Icelandic translation\n> which I've had on my backlog I might translate something like this:\n> ...\n> I.e. even though you might be running \"git merge\" or \"git revert\" the\n> UI is talking about those terms in the translated using native terms\n> for the action of merging or reverting, but referring to the literal\n> command names in English.\n> ...\n> It just doesn't flow as well, and leads to a more verbose translation.\n\nOK.  I couldn't judge your example in Icelandic, but I have enough\ntrust in you to believe your conclusion ;-).\n\n> Now instead of referring to the translated verb I'd already\n> established I have to just refer to literal command names.\n>\n> Both this change and the change you submitted in\n> <1463585274-9027-4-git-send-email-vascomalmeida@sapo.pt> and Junio\n> didn't like in <xmqqd1ojqciz.fsf@gitster.mtv.corp.google.com> are\n> actual examples of cases where if I was (finally getting of my ass to)\n> doing the Icelandic translation I'd take advantage of this.\n"},{"id":"287218","messageId":"CAPig+cSoq=+jsKPrqOG5khgK64VvyuJ1_EeumFBFYiaLnL27UA@mail.gmail.com","threadId":"42369","inReplyTo":"xmqqk2ilbo2o.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH 05/21] i18n: sequencer: mark entire sentences for translation","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2016-05-23T01:00:37Z","receivedAt":"2016-05-23T01:00:37Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Sun, May 22, 2016 at 8:44 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:\n>> For what it's worth I agree with you and disagree with Eric here and\n>> Junio in the \"[PATCH 03/21] i18n: advice: internationalize message for\n>> conflicts\" thread.\n>>\n>> Of course there's a trade-off in source code verbosity when you have\n>> to change every occurance of (pseudocode):\n>>\n>>     \"our %s failed\" # %s can be revert or merge\n>>\n>> to:\n>>\n>>     if (action == \"merge\")\n>>         gettext(\"our merge failed\")\n>>     elsif (action == \"revert\")\n>>         gettext(\"our revert failed\")\n>>\n>> But forcing the translator to turn every such occurrence that flows\n>> naturally in English into \"the '%s' command failed\" leads to a worse\n>> translation.\n>>\n>> For example, if I ever get around to doing the Icelandic translation\n>> which I've had on my backlog I might translate something like this:\n>> ...\n>> I.e. even though you might be running \"git merge\" or \"git revert\" the\n>> UI is talking about those terms in the translated using native terms\n>> for the action of merging or reverting, but referring to the literal\n>> command names in English.\n>> ...\n>> It just doesn't flow as well, and leads to a more verbose translation.\n>\n> OK.  I couldn't judge your example in Icelandic, but I have enough\n> trust in you to believe your conclusion ;-).\n\nI have no problem viewing the issue from either side (the sentence\nreferencing a *literal* command or the *action* of the command), and\nunderstood that it could go either way when I wrote the review. What\nthrew me was that 3/21 seemed to be using the literal command in the\nstrings rather than the action, despite the commit message. For\ninstance:\n\n    error(_(\"commit is not possible because ...\"));\n    error(_(\"merge is not possible because ...\"));\n    error(_(\"pull is not possible because ...\"));\n    error(_(\"revert is not possible because ...\"));\n\nIn each case, the first word looks like a git command; it's not\nparticularly grammatically correct. Had Vasco instead changed them to:\n\n    committing is not possible...\n    merging is not possible...\n    pulling is not possible...\n    reverting is not posible...\n\nthen the issue likely would never have come up.\n"}]}