{"thread":{"id":"44296","subject":"[PATCH 1/3] i18n: apply: mark plural string for translation","startedAt":"2016-10-14T11:47:29Z","lastAt":"2016-10-16T00:34:35Z","messageCount":4,"participants":["Vasco Almeida","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"304104","messageId":"20161014114337.18684-1-vascomalmeida@sapo.pt","threadId":"44296","inReplyTo":null,"subject":"[PATCH 1/3] i18n: apply: mark plural string for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-10-14T11:43:35Z","receivedAt":"2016-10-14T11:47:29Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Mark plural string for translation using Q_().\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n apply.c | 10 ++++++----\n 1 file changed, 6 insertions(+), 4 deletions(-)\n\ndiff --git a/apply.c b/apply.c\nindex b03d274..201d3a7 100644\n--- a/apply.c\n+++ b/apply.c\n@@ -4869,10 +4869,12 @@ int apply_all_patches(struct apply_state *state,\n \t\t\tgoto end;\n \t\t}\n \t\tif (state->applied_after_fixing_ws && state->apply)\n-\t\t\twarning(\"%d line%s applied after\"\n-\t\t\t\t\" fixing whitespace errors.\",\n-\t\t\t\tstate->applied_after_fixing_ws,\n-\t\t\t\tstate->applied_after_fixing_ws == 1 ? \"\" : \"s\");\n+\t\t\twarning(Q_(\"%d line applied after\"\n+\t\t\t\t   \" fixing whitespace errors.\",\n+\t\t\t\t   \"%d lines applied after\"\n+\t\t\t\t   \" fixing whitespace errors.\",\n+\t\t\t\t   state->applied_after_fixing_ws),\n+\t\t\t\tstate->applied_after_fixing_ws);\n \t\telse if (state->whitespace_error)\n \t\t\twarning(Q_(\"%d line adds whitespace errors.\",\n \t\t\t\t   \"%d lines add whitespace errors.\",\n-- \n2.10.1.459.g5fd885d\n\n"},{"id":"304105","messageId":"20161014114337.18684-2-vascomalmeida@sapo.pt","threadId":"44296","inReplyTo":"20161014114337.18684-1-vascomalmeida@sapo.pt","subject":"[PATCH 2/3] i18n: apply: mark info messages for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-10-14T11:43:36Z","receivedAt":"2016-10-14T11:47:33Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Mark messages for translation printed to stderr.\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n apply.c | 8 ++++----\n 1 file changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/apply.c b/apply.c\nindex 201d3a7..13b2064 100644\n--- a/apply.c\n+++ b/apply.c\n@@ -3554,7 +3554,7 @@ static int try_threeway(struct apply_state *state,\n \t\treturn error(\"repository lacks the necessary blob to fall back on 3-way merge.\");\n \n \tif (state->apply_verbosity > verbosity_silent)\n-\t\tfprintf(stderr, \"Falling back to three-way merge...\\n\");\n+\t\tfprintf(stderr, _(\"Falling back to three-way merge...\\n\"));\n \n \timg = strbuf_detach(&buf, &len);\n \tprepare_image(&tmp_image, img, len, 1);\n@@ -3586,7 +3586,7 @@ static int try_threeway(struct apply_state *state,\n \tif (status < 0) {\n \t\tif (state->apply_verbosity > verbosity_silent)\n \t\t\tfprintf(stderr,\n-\t\t\t\t\"Failed to fall back on three-way merge...\\n\");\n+\t\t\t\t_(\"Failed to fall back on three-way merge...\\n\"));\n \t\treturn status;\n \t}\n \n@@ -3600,12 +3600,12 @@ static int try_threeway(struct apply_state *state,\n \t\toidcpy(&patch->threeway_stage[2], &post_oid);\n \t\tif (state->apply_verbosity > verbosity_silent)\n \t\t\tfprintf(stderr,\n-\t\t\t\t\"Applied patch to '%s' with conflicts.\\n\",\n+\t\t\t\t_(\"Applied patch to '%s' with conflicts.\\n\"),\n \t\t\t\tpatch->new_name);\n \t} else {\n \t\tif (state->apply_verbosity > verbosity_silent)\n \t\t\tfprintf(stderr,\n-\t\t\t\t\"Applied patch to '%s' cleanly.\\n\",\n+\t\t\t\t_(\"Applied patch to '%s' cleanly.\\n\"),\n \t\t\t\tpatch->new_name);\n \t}\n \treturn 0;\n-- \n2.10.1.459.g5fd885d\n\n"},{"id":"304106","messageId":"20161014114337.18684-3-vascomalmeida@sapo.pt","threadId":"44296","inReplyTo":"20161014114337.18684-1-vascomalmeida@sapo.pt","subject":"[PATCH 3/3] i18n: apply: mark error messages for translation","fromName":"Vasco Almeida","fromEmail":"vascomalmeida@sapo.pt","sentAt":"2016-10-14T11:43:37Z","receivedAt":"2016-10-14T11:47:36Z","isPatch":true,"sender":{"key":"vascomalmeida@sapo.pt","avatar":"https://avatars.githubusercontent.com/u/9001556?v=4"},"body":"Mark error messages for translation passed to error() and die()\nfunctions.\n\nSigned-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n---\n apply.c | 48 ++++++++++++++++++++++++------------------------\n 1 file changed, 24 insertions(+), 24 deletions(-)\n\ndiff --git a/apply.c b/apply.c\nindex 13b2064..8215874 100644\n--- a/apply.c\n+++ b/apply.c\n@@ -122,9 +122,9 @@ int check_apply_state(struct apply_state *state, int force_apply)\n \tint is_not_gitdir = !startup_info->have_repository;\n \n \tif (state->apply_with_reject && state->threeway)\n-\t\treturn error(\"--reject and --3way cannot be used together.\");\n+\t\treturn error(_(\"--reject and --3way cannot be used together.\"));\n \tif (state->cached && state->threeway)\n-\t\treturn error(\"--cached and --3way cannot be used together.\");\n+\t\treturn error(_(\"--cached and --3way cannot be used together.\"));\n \tif (state->threeway) {\n \t\tif (is_not_gitdir)\n \t\t\treturn error(_(\"--3way outside a repository\"));\n@@ -3095,8 +3095,8 @@ static int apply_binary_fragment(struct apply_state *state,\n \t/* Binary patch is irreversible without the optional second hunk */\n \tif (state->apply_in_reverse) {\n \t\tif (!fragment->next)\n-\t\t\treturn error(\"cannot reverse-apply a binary patch \"\n-\t\t\t\t     \"without the reverse hunk to '%s'\",\n+\t\t\treturn error(_(\"cannot reverse-apply a binary patch \"\n+\t\t\t\t       \"without the reverse hunk to '%s'\"),\n \t\t\t\t     patch->new_name\n \t\t\t\t     ? patch->new_name : patch->old_name);\n \t\tfragment = fragment->next;\n@@ -3141,8 +3141,8 @@ static int apply_binary(struct apply_state *state,\n \t    strlen(patch->new_sha1_prefix) != 40 ||\n \t    get_oid_hex(patch->old_sha1_prefix, &oid) ||\n \t    get_oid_hex(patch->new_sha1_prefix, &oid))\n-\t\treturn error(\"cannot apply binary patch to '%s' \"\n-\t\t\t     \"without full index line\", name);\n+\t\treturn error(_(\"cannot apply binary patch to '%s' \"\n+\t\t\t       \"without full index line\"), name);\n \n \tif (patch->old_name) {\n \t\t/*\n@@ -3151,16 +3151,16 @@ static int apply_binary(struct apply_state *state,\n \t\t */\n \t\thash_sha1_file(img->buf, img->len, blob_type, oid.hash);\n \t\tif (strcmp(oid_to_hex(&oid), patch->old_sha1_prefix))\n-\t\t\treturn error(\"the patch applies to '%s' (%s), \"\n-\t\t\t\t     \"which does not match the \"\n-\t\t\t\t     \"current contents.\",\n+\t\t\treturn error(_(\"the patch applies to '%s' (%s), \"\n+\t\t\t\t       \"which does not match the \"\n+\t\t\t\t       \"current contents.\"),\n \t\t\t\t     name, oid_to_hex(&oid));\n \t}\n \telse {\n \t\t/* Otherwise, the old one must be empty. */\n \t\tif (img->len)\n-\t\t\treturn error(\"the patch applies to an empty \"\n-\t\t\t\t     \"'%s' but it is not empty\", name);\n+\t\t\treturn error(_(\"the patch applies to an empty \"\n+\t\t\t\t       \"'%s' but it is not empty\"), name);\n \t}\n \n \tget_oid_hex(patch->new_sha1_prefix, &oid);\n@@ -3177,8 +3177,8 @@ static int apply_binary(struct apply_state *state,\n \n \t\tresult = read_sha1_file(oid.hash, &type, &size);\n \t\tif (!result)\n-\t\t\treturn error(\"the necessary postimage %s for \"\n-\t\t\t\t     \"'%s' cannot be read\",\n+\t\t\treturn error(_(\"the necessary postimage %s for \"\n+\t\t\t\t       \"'%s' cannot be read\"),\n \t\t\t\t     patch->new_sha1_prefix, name);\n \t\tclear_image(img);\n \t\timg->buf = result;\n@@ -3551,7 +3551,7 @@ static int try_threeway(struct apply_state *state,\n \t\twrite_sha1_file(\"\", 0, blob_type, pre_oid.hash);\n \telse if (get_sha1(patch->old_sha1_prefix, pre_oid.hash) ||\n \t\t read_blob_object(&buf, &pre_oid, patch->old_mode))\n-\t\treturn error(\"repository lacks the necessary blob to fall back on 3-way merge.\");\n+\t\treturn error(_(\"repository lacks the necessary blob to fall back on 3-way merge.\"));\n \n \tif (state->apply_verbosity > verbosity_silent)\n \t\tfprintf(stderr, _(\"Falling back to three-way merge...\\n\"));\n@@ -3570,11 +3570,11 @@ static int try_threeway(struct apply_state *state,\n \t/* our_oid is ours */\n \tif (patch->is_new) {\n \t\tif (load_current(state, &tmp_image, patch))\n-\t\t\treturn error(\"cannot read the current contents of '%s'\",\n+\t\t\treturn error(_(\"cannot read the current contents of '%s'\"),\n \t\t\t\t     patch->new_name);\n \t} else {\n \t\tif (load_preimage(state, &tmp_image, patch, st, ce))\n-\t\t\treturn error(\"cannot read the current contents of '%s'\",\n+\t\t\treturn error(_(\"cannot read the current contents of '%s'\"),\n \t\t\t\t     patch->old_name);\n \t}\n \twrite_sha1_file(tmp_image.buf, tmp_image.len, blob_type, our_oid.hash);\n@@ -4072,18 +4072,18 @@ static int build_fake_ancestor(struct apply_state *state, struct patch *list)\n \t\t\tif (!preimage_oid_in_gitlink_patch(patch, &oid))\n \t\t\t\t; /* ok, the textual part looks sane */\n \t\t\telse\n-\t\t\t\treturn error(\"sha1 information is lacking or \"\n-\t\t\t\t\t     \"useless for submodule %s\", name);\n+\t\t\t\treturn error(_(\"sha1 information is lacking or \"\n+\t\t\t\t\t       \"useless for submodule %s\"), name);\n \t\t} else if (!get_sha1_blob(patch->old_sha1_prefix, oid.hash)) {\n \t\t\t; /* ok */\n \t\t} else if (!patch->lines_added && !patch->lines_deleted) {\n \t\t\t/* mode-only change: update the current */\n \t\t\tif (get_current_oid(state, patch->old_name, &oid))\n-\t\t\t\treturn error(\"mode change for %s, which is not \"\n-\t\t\t\t\t     \"in current HEAD\", name);\n+\t\t\t\treturn error(_(\"mode change for %s, which is not \"\n+\t\t\t\t\t       \"in current HEAD\"), name);\n \t\t} else\n-\t\t\treturn error(\"sha1 information is lacking or useless \"\n-\t\t\t\t     \"(%s).\", name);\n+\t\t\treturn error(_(\"sha1 information is lacking or useless \"\n+\t\t\t\t       \"(%s).\"), name);\n \n \t\tce = make_cache_entry(patch->old_mode, oid.hash, name, 0, 0);\n \t\tif (!ce)\n@@ -4091,7 +4091,7 @@ static int build_fake_ancestor(struct apply_state *state, struct patch *list)\n \t\t\t\t     name);\n \t\tif (add_index_entry(&result, ce, ADD_CACHE_OK_TO_ADD)) {\n \t\t\tfree(ce);\n-\t\t\treturn error(\"Could not add %s to temporary index\",\n+\t\t\treturn error(_(\"could not add %s to temporary index\"),\n \t\t\t\t     name);\n \t\t}\n \t}\n@@ -4101,7 +4101,7 @@ static int build_fake_ancestor(struct apply_state *state, struct patch *list)\n \tdiscard_index(&result);\n \n \t if (res)\n-\t\t return error(\"Could not write temporary index to %s\",\n+\t\t return error(_(\"could not write temporary index to %s\"),\n \t\t\t      state->fake_ancestor);\n \n \t return 0;\n-- \n2.10.1.459.g5fd885d\n\n"},{"id":"304221","messageId":"xmqqbmymzufr.fsf@gitster.mtv.corp.google.com","threadId":"44296","inReplyTo":"20161014114337.18684-1-vascomalmeida@sapo.pt","subject":"Re: [PATCH 1/3] i18n: apply: mark plural string for translation","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-10-14T17:55:52Z","receivedAt":"2016-10-16T00:34:35Z","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> Mark plural string for translation using Q_().\n>\n> Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>\n> ---\n\nThanks for waiting (patiently) for 'master' to become ready to take\nthese three patches.\n\n\n"}]}