{"thread":{"id":"33496","subject":"[PATCH] i18n: branch: mark strings for translation","startedAt":"2013-04-13T02:22:49Z","lastAt":"2013-04-16T04:18:16Z","messageCount":6,"participants":["Jiang Xin","Duy Nguyen","Jonathan Nieder","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"214116","messageId":"d11a226dac05ea7e8ee1d6166a1be1acee360a03.1365819645.git.worldhello.net@gmail.com","threadId":"33496","inReplyTo":null,"subject":"[PATCH] i18n: branch: mark strings for translation","fromName":"Jiang Xin","fromEmail":"worldhello.net@gmail.com","sentAt":"2013-04-13T02:22:49Z","receivedAt":"2013-04-13T02:22:49Z","isPatch":true,"sender":{"key":"worldhello.net@gmail.com","avatar":"https://avatars.githubusercontent.com/u/183860?v=4"},"body":"Signed-off-by: Jiang Xin <worldhello.net@gmail.com>\n---\n branch.c | 40 ++++++++++++++++++++--------------------\n 1 file changed, 20 insertions(+), 20 deletions(-)\n\ndiff --git a/branch.c b/branch.c\nindex 6ae6a..c8745 100644\n--- a/branch.c\n+++ b/branch.c\n@@ -57,7 +57,7 @@ void install_branch_config(int flag, const char *local, const char *origin, cons\n \tif (remote_is_branch\n \t    && !strcmp(local, shortname)\n \t    && !origin) {\n-\t\twarning(\"Not setting branch %s as its own upstream.\",\n+\t\twarning(_(\"Not setting branch %s as its own upstream.\"),\n \t\t\tlocal);\n \t\treturn;\n \t}\n@@ -79,26 +79,26 @@ void install_branch_config(int flag, const char *local, const char *origin, cons\n \tif (flag & BRANCH_CONFIG_VERBOSE) {\n \t\tif (remote_is_branch && origin)\n \t\t\tprintf(rebasing ?\n-\t\t\t       \"Branch %s set up to track remote branch %s from %s by rebasing.\\n\" :\n-\t\t\t       \"Branch %s set up to track remote branch %s from %s.\\n\",\n+\t\t\t       _(\"Branch %s set up to track remote branch %s from %s by rebasing.\\n\") :\n+\t\t\t       _(\"Branch %s set up to track remote branch %s from %s.\\n\"),\n \t\t\t       local, shortname, origin);\n \t\telse if (remote_is_branch && !origin)\n \t\t\tprintf(rebasing ?\n-\t\t\t       \"Branch %s set up to track local branch %s by rebasing.\\n\" :\n-\t\t\t       \"Branch %s set up to track local branch %s.\\n\",\n+\t\t\t       _(\"Branch %s set up to track local branch %s by rebasing.\\n\") :\n+\t\t\t       _(\"Branch %s set up to track local branch %s.\\n\"),\n \t\t\t       local, shortname);\n \t\telse if (!remote_is_branch && origin)\n \t\t\tprintf(rebasing ?\n-\t\t\t       \"Branch %s set up to track remote ref %s by rebasing.\\n\" :\n-\t\t\t       \"Branch %s set up to track remote ref %s.\\n\",\n+\t\t\t       _(\"Branch %s set up to track remote ref %s by rebasing.\\n\") :\n+\t\t\t       _(\"Branch %s set up to track remote ref %s.\\n\"),\n \t\t\t       local, remote);\n \t\telse if (!remote_is_branch && !origin)\n \t\t\tprintf(rebasing ?\n-\t\t\t       \"Branch %s set up to track local ref %s by rebasing.\\n\" :\n-\t\t\t       \"Branch %s set up to track local ref %s.\\n\",\n+\t\t\t       _(\"Branch %s set up to track local ref %s by rebasing.\\n\") :\n+\t\t\t       _(\"Branch %s set up to track local ref %s.\\n\"),\n \t\t\t       local, remote);\n \t\telse\n-\t\t\tdie(\"BUG: impossible combination of %d and %p\",\n+\t\t\tdie(_(\"BUG: impossible combination of %d and %p\"),\n \t\t\t    remote_is_branch, origin);\n \t}\n }\n@@ -115,7 +115,7 @@ static int setup_tracking(const char *new_ref, const char *orig_ref,\n \tint config_flags = quiet ? 0 : BRANCH_CONFIG_VERBOSE;\n \n \tif (strlen(new_ref) > 1024 - 7 - 7 - 1)\n-\t\treturn error(\"Tracking not set up: name too long: %s\",\n+\t\treturn error(_(\"Tracking not set up: name too long: %s\"),\n \t\t\t\tnew_ref);\n \n \tmemset(&tracking, 0, sizeof(tracking));\n@@ -134,7 +134,7 @@ static int setup_tracking(const char *new_ref, const char *orig_ref,\n \t\t}\n \n \tif (tracking.matches > 1)\n-\t\treturn error(\"Not tracking: ambiguous information for ref %s\",\n+\t\treturn error(_(\"Not tracking: ambiguous information for ref %s\"),\n \t\t\t\torig_ref);\n \n \tinstall_branch_config(config_flags, new_ref, tracking.remote,\n@@ -179,12 +179,12 @@ int validate_new_branchname(const char *name, struct strbuf *ref,\n \t\t\t    int force, int attr_only)\n {\n \tif (strbuf_check_branch_ref(ref, name))\n-\t\tdie(\"'%s' is not a valid branch name.\", name);\n+\t\tdie(_(\"'%s' is not a valid branch name.\"), name);\n \n \tif (!ref_exists(ref->buf))\n \t\treturn 0;\n \telse if (!force && !attr_only)\n-\t\tdie(\"A branch named '%s' already exists.\", ref->buf + strlen(\"refs/heads/\"));\n+\t\tdie(_(\"A branch named '%s' already exists.\"), ref->buf + strlen(\"refs/heads/\"));\n \n \tif (!attr_only) {\n \t\tconst char *head;\n@@ -192,7 +192,7 @@ int validate_new_branchname(const char *name, struct strbuf *ref,\n \n \t\thead = resolve_ref_unsafe(\"HEAD\", sha1, 0, NULL);\n \t\tif (!is_bare_repository() && head && !strcmp(head, ref->buf))\n-\t\t\tdie(\"Cannot force update the current branch.\");\n+\t\t\tdie(_(\"Cannot force update the current branch.\"));\n \t}\n \treturn 1;\n }\n@@ -247,7 +247,7 @@ void create_branch(const char *head,\n \t\t\t}\n \t\t\tdie(_(upstream_missing), start_name);\n \t\t}\n-\t\tdie(\"Not a valid object name: '%s'.\", start_name);\n+\t\tdie(_(\"Not a valid object name: '%s'.\"), start_name);\n \t}\n \n \tswitch (dwim_ref(start_name, strlen(start_name), sha1, &real_ref)) {\n@@ -267,18 +267,18 @@ void create_branch(const char *head,\n \t\t}\n \t\tbreak;\n \tdefault:\n-\t\tdie(\"Ambiguous object name: '%s'.\", start_name);\n+\t\tdie(_(\"Ambiguous object name: '%s'.\"), start_name);\n \t\tbreak;\n \t}\n \n \tif ((commit = lookup_commit_reference(sha1)) == NULL)\n-\t\tdie(\"Not a valid branch point: '%s'.\", start_name);\n+\t\tdie(_(\"Not a valid branch point: '%s'.\"), start_name);\n \thashcpy(sha1, commit->object.sha1);\n \n \tif (!dont_change_ref) {\n \t\tlock = lock_any_ref_for_update(ref.buf, NULL, 0);\n \t\tif (!lock)\n-\t\t\tdie_errno(\"Failed to lock ref for update\");\n+\t\t\tdie_errno(_(\"Failed to lock ref for update\"));\n \t}\n \n \tif (reflog)\n@@ -296,7 +296,7 @@ void create_branch(const char *head,\n \n \tif (!dont_change_ref)\n \t\tif (write_ref_sha1(lock, sha1, msg) < 0)\n-\t\t\tdie_errno(\"Failed to write ref\");\n+\t\t\tdie_errno(_(\"Failed to write ref\"));\n \n \tstrbuf_release(&ref);\n \tfree(real_ref);\n-- \n1.8.2.1.350.g76f6571.dirty\n"},{"id":"214121","messageId":"CACsJy8DK5U3XErjDYZJZ+RBywDypuDotc-cH=CYGcd9Pu=V4PQ@mail.gmail.com","threadId":"33496","inReplyTo":"d11a226dac05ea7e8ee1d6166a1be1acee360a03.1365819645.git.worldhello.net@gmail.com","subject":"Re: [PATCH] i18n: branch: mark strings for translation","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2013-04-13T04:29:43Z","receivedAt":"2013-04-13T04:29:43Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Sat, Apr 13, 2013 at 12:22 PM, Jiang Xin <worldhello.net@gmail.com> wrote:\n> diff --git a/branch.c b/branch.c\n> index 6ae6a..c8745 100644\n>                 else\n> -                       die(\"BUG: impossible combination of %d and %p\",\n> +                       die(_(\"BUG: impossible combination of %d and %p\"),\n>                             remote_is_branch, origin);\n>         }\n>  }\n\nYou might want to leave this out. I can hardly happen in real life. If\nit is, the unfortunate user just needs to copy it straight to\ngit@vger.\n--\nDuy\n"},{"id":"214136","messageId":"b841ddcc538f77c89859efe867fc638005dc13f9.1365861788.git.worldhello.net@gmail.com","threadId":"33496","inReplyTo":"CACsJy8DK5U3XErjDYZJZ+RBywDypuDotc-cH=CYGcd9Pu=V4PQ@mail.gmail.com","subject":"[PATCH v2] i18n: branch: mark strings for translation","fromName":"Jiang Xin","fromEmail":"worldhello.net@gmail.com","sentAt":"2013-04-13T14:08:27Z","receivedAt":"2013-04-13T14:08:27Z","isPatch":true,"sender":{"key":"worldhello.net@gmail.com","avatar":"https://avatars.githubusercontent.com/u/183860?v=4"},"body":"Signed-off-by: Jiang Xin <worldhello.net@gmail.com>\nReviewed-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\nNot mark \"BUG: impossible combination of %d and %p\", which would\nnever happen.\n\n branch.c | 38 +++++++++++++++++++-------------------\n 1 file changed, 19 insertions(+), 19 deletions(-)\n\ndiff --git a/branch.c b/branch.c\nindex 6ae6a..4ddd69 100644\n--- a/branch.c\n+++ b/branch.c\n@@ -57,7 +57,7 @@ void install_branch_config(int flag, const char *local, const char *origin, cons\n \tif (remote_is_branch\n \t    && !strcmp(local, shortname)\n \t    && !origin) {\n-\t\twarning(\"Not setting branch %s as its own upstream.\",\n+\t\twarning(_(\"Not setting branch %s as its own upstream.\"),\n \t\t\tlocal);\n \t\treturn;\n \t}\n@@ -79,23 +79,23 @@ void install_branch_config(int flag, const char *local, const char *origin, cons\n \tif (flag & BRANCH_CONFIG_VERBOSE) {\n \t\tif (remote_is_branch && origin)\n \t\t\tprintf(rebasing ?\n-\t\t\t       \"Branch %s set up to track remote branch %s from %s by rebasing.\\n\" :\n-\t\t\t       \"Branch %s set up to track remote branch %s from %s.\\n\",\n+\t\t\t       _(\"Branch %s set up to track remote branch %s from %s by rebasing.\\n\") :\n+\t\t\t       _(\"Branch %s set up to track remote branch %s from %s.\\n\"),\n \t\t\t       local, shortname, origin);\n \t\telse if (remote_is_branch && !origin)\n \t\t\tprintf(rebasing ?\n-\t\t\t       \"Branch %s set up to track local branch %s by rebasing.\\n\" :\n-\t\t\t       \"Branch %s set up to track local branch %s.\\n\",\n+\t\t\t       _(\"Branch %s set up to track local branch %s by rebasing.\\n\") :\n+\t\t\t       _(\"Branch %s set up to track local branch %s.\\n\"),\n \t\t\t       local, shortname);\n \t\telse if (!remote_is_branch && origin)\n \t\t\tprintf(rebasing ?\n-\t\t\t       \"Branch %s set up to track remote ref %s by rebasing.\\n\" :\n-\t\t\t       \"Branch %s set up to track remote ref %s.\\n\",\n+\t\t\t       _(\"Branch %s set up to track remote ref %s by rebasing.\\n\") :\n+\t\t\t       _(\"Branch %s set up to track remote ref %s.\\n\"),\n \t\t\t       local, remote);\n \t\telse if (!remote_is_branch && !origin)\n \t\t\tprintf(rebasing ?\n-\t\t\t       \"Branch %s set up to track local ref %s by rebasing.\\n\" :\n-\t\t\t       \"Branch %s set up to track local ref %s.\\n\",\n+\t\t\t       _(\"Branch %s set up to track local ref %s by rebasing.\\n\") :\n+\t\t\t       _(\"Branch %s set up to track local ref %s.\\n\"),\n \t\t\t       local, remote);\n \t\telse\n \t\t\tdie(\"BUG: impossible combination of %d and %p\",\n@@ -115,7 +115,7 @@ static int setup_tracking(const char *new_ref, const char *orig_ref,\n \tint config_flags = quiet ? 0 : BRANCH_CONFIG_VERBOSE;\n \n \tif (strlen(new_ref) > 1024 - 7 - 7 - 1)\n-\t\treturn error(\"Tracking not set up: name too long: %s\",\n+\t\treturn error(_(\"Tracking not set up: name too long: %s\"),\n \t\t\t\tnew_ref);\n \n \tmemset(&tracking, 0, sizeof(tracking));\n@@ -134,7 +134,7 @@ static int setup_tracking(const char *new_ref, const char *orig_ref,\n \t\t}\n \n \tif (tracking.matches > 1)\n-\t\treturn error(\"Not tracking: ambiguous information for ref %s\",\n+\t\treturn error(_(\"Not tracking: ambiguous information for ref %s\"),\n \t\t\t\torig_ref);\n \n \tinstall_branch_config(config_flags, new_ref, tracking.remote,\n@@ -179,12 +179,12 @@ int validate_new_branchname(const char *name, struct strbuf *ref,\n \t\t\t    int force, int attr_only)\n {\n \tif (strbuf_check_branch_ref(ref, name))\n-\t\tdie(\"'%s' is not a valid branch name.\", name);\n+\t\tdie(_(\"'%s' is not a valid branch name.\"), name);\n \n \tif (!ref_exists(ref->buf))\n \t\treturn 0;\n \telse if (!force && !attr_only)\n-\t\tdie(\"A branch named '%s' already exists.\", ref->buf + strlen(\"refs/heads/\"));\n+\t\tdie(_(\"A branch named '%s' already exists.\"), ref->buf + strlen(\"refs/heads/\"));\n \n \tif (!attr_only) {\n \t\tconst char *head;\n@@ -192,7 +192,7 @@ int validate_new_branchname(const char *name, struct strbuf *ref,\n \n \t\thead = resolve_ref_unsafe(\"HEAD\", sha1, 0, NULL);\n \t\tif (!is_bare_repository() && head && !strcmp(head, ref->buf))\n-\t\t\tdie(\"Cannot force update the current branch.\");\n+\t\t\tdie(_(\"Cannot force update the current branch.\"));\n \t}\n \treturn 1;\n }\n@@ -247,7 +247,7 @@ void create_branch(const char *head,\n \t\t\t}\n \t\t\tdie(_(upstream_missing), start_name);\n \t\t}\n-\t\tdie(\"Not a valid object name: '%s'.\", start_name);\n+\t\tdie(_(\"Not a valid object name: '%s'.\"), start_name);\n \t}\n \n \tswitch (dwim_ref(start_name, strlen(start_name), sha1, &real_ref)) {\n@@ -267,18 +267,18 @@ void create_branch(const char *head,\n \t\t}\n \t\tbreak;\n \tdefault:\n-\t\tdie(\"Ambiguous object name: '%s'.\", start_name);\n+\t\tdie(_(\"Ambiguous object name: '%s'.\"), start_name);\n \t\tbreak;\n \t}\n \n \tif ((commit = lookup_commit_reference(sha1)) == NULL)\n-\t\tdie(\"Not a valid branch point: '%s'.\", start_name);\n+\t\tdie(_(\"Not a valid branch point: '%s'.\"), start_name);\n \thashcpy(sha1, commit->object.sha1);\n \n \tif (!dont_change_ref) {\n \t\tlock = lock_any_ref_for_update(ref.buf, NULL, 0);\n \t\tif (!lock)\n-\t\t\tdie_errno(\"Failed to lock ref for update\");\n+\t\t\tdie_errno(_(\"Failed to lock ref for update\"));\n \t}\n \n \tif (reflog)\n@@ -296,7 +296,7 @@ void create_branch(const char *head,\n \n \tif (!dont_change_ref)\n \t\tif (write_ref_sha1(lock, sha1, msg) < 0)\n-\t\t\tdie_errno(\"Failed to write ref\");\n+\t\t\tdie_errno(_(\"Failed to write ref\"));\n \n \tstrbuf_release(&ref);\n \tfree(real_ref);\n-- \n1.8.2.1.350.g7baa3ba\n"},{"id":"214418","messageId":"20130416024021.GG3262@elie.Belkin","threadId":"33496","inReplyTo":"b841ddcc538f77c89859efe867fc638005dc13f9.1365861788.git.worldhello.net@gmail.com","subject":"Re: [PATCH v2] i18n: branch: mark strings for translation","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2013-04-16T02:40:21Z","receivedAt":"2013-04-16T02:40:21Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Jiang Xin wrote:\n\n> --- a/branch.c\n> +++ b/branch.c\n[...]\n> @@ -79,23 +79,23 @@ void install_branch_config(int flag, const char *local, const char *origin, cons\n>  \tif (flag & BRANCH_CONFIG_VERBOSE) {\n>  \t\tif (remote_is_branch && origin)\n>  \t\t\tprintf(rebasing ?\n> -\t\t\t       \"Branch %s set up to track remote branch %s from %s by rebasing.\\n\" :\n> -\t\t\t       \"Branch %s set up to track remote branch %s from %s.\\n\",\n> +\t\t\t       _(\"Branch %s set up to track remote branch %s from %s by rebasing.\\n\") :\n> +\t\t\t       _(\"Branch %s set up to track remote branch %s from %s.\\n\"),\n\nMicronit: it would be nicer to use printf_ln to save translators the\ntrouble of worrying about the final newline.\n\nWith that change,\nReviewed-by: Jonathan Nieder <jrnieder@gmail.com>\n\nThanks.  Here's a patch making that change for squashing in.\n\ndiff --git i/branch.c w/branch.c\nindex 4ddd69f3..c67b97d1 100644\n--- i/branch.c\n+++ w/branch.c\n@@ -78,24 +78,24 @@ void install_branch_config(int flag, const char *local, const char *origin, cons\n \n \tif (flag & BRANCH_CONFIG_VERBOSE) {\n \t\tif (remote_is_branch && origin)\n-\t\t\tprintf(rebasing ?\n-\t\t\t       _(\"Branch %s set up to track remote branch %s from %s by rebasing.\\n\") :\n-\t\t\t       _(\"Branch %s set up to track remote branch %s from %s.\\n\"),\n+\t\t\tprintf_ln(rebasing ?\n+\t\t\t       _(\"Branch %s set up to track remote branch %s from %s by rebasing.\") :\n+\t\t\t       _(\"Branch %s set up to track remote branch %s from %s.\"),\n \t\t\t       local, shortname, origin);\n \t\telse if (remote_is_branch && !origin)\n-\t\t\tprintf(rebasing ?\n-\t\t\t       _(\"Branch %s set up to track local branch %s by rebasing.\\n\") :\n-\t\t\t       _(\"Branch %s set up to track local branch %s.\\n\"),\n+\t\t\tprintf_ln(rebasing ?\n+\t\t\t       _(\"Branch %s set up to track local branch %s by rebasing.\") :\n+\t\t\t       _(\"Branch %s set up to track local branch %s.\"),\n \t\t\t       local, shortname);\n \t\telse if (!remote_is_branch && origin)\n-\t\t\tprintf(rebasing ?\n-\t\t\t       _(\"Branch %s set up to track remote ref %s by rebasing.\\n\") :\n-\t\t\t       _(\"Branch %s set up to track remote ref %s.\\n\"),\n+\t\t\tprintf_ln(rebasing ?\n+\t\t\t       _(\"Branch %s set up to track remote ref %s by rebasing.\") :\n+\t\t\t       _(\"Branch %s set up to track remote ref %s.\"),\n \t\t\t       local, remote);\n \t\telse if (!remote_is_branch && !origin)\n-\t\t\tprintf(rebasing ?\n-\t\t\t       _(\"Branch %s set up to track local ref %s by rebasing.\\n\") :\n-\t\t\t       _(\"Branch %s set up to track local ref %s.\\n\"),\n+\t\t\tprintf_ln(rebasing ?\n+\t\t\t       _(\"Branch %s set up to track local ref %s by rebasing.\") :\n+\t\t\t       _(\"Branch %s set up to track local ref %s.\"),\n \t\t\t       local, remote);\n \t\telse\n \t\t\tdie(\"BUG: impossible combination of %d and %p\",\n"},{"id":"214426","messageId":"e31669b2dc24ac07de4ed23e00d5a38de5fcda8b.1366082959.git.worldhello.net@gmail.com","threadId":"33496","inReplyTo":"20130416024021.GG3262@elie.Belkin","subject":"[PATCH v3] i18n: branch: mark strings for translation","fromName":"Jiang Xin","fromEmail":"worldhello.net@gmail.com","sentAt":"2013-04-16T03:37:50Z","receivedAt":"2013-04-16T03:37:50Z","isPatch":true,"sender":{"key":"worldhello.net@gmail.com","avatar":"https://avatars.githubusercontent.com/u/183860?v=4"},"body":"Signed-off-by: Jiang Xin <worldhello.net@gmail.com>\nReviewed-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\nReviewed-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n> Micronit: it would be nicer to use printf_ln to save translators the\n> trouble of worrying about the final newline.\nReroll with the help of Jonathan Nieder.\n\n branch.c | 54 +++++++++++++++++++++++++++---------------------------\n 1 file changed, 27 insertions(+), 27 deletions(-)\n\ndiff --git a/branch.c b/branch.c\nindex 6ae6a..97c72 100644\n--- a/branch.c\n+++ b/branch.c\n@@ -57,7 +57,7 @@ void install_branch_config(int flag, const char *local, const char *origin, cons\n \tif (remote_is_branch\n \t    && !strcmp(local, shortname)\n \t    && !origin) {\n-\t\twarning(\"Not setting branch %s as its own upstream.\",\n+\t\twarning(_(\"Not setting branch %s as its own upstream.\"),\n \t\t\tlocal);\n \t\treturn;\n \t}\n@@ -78,25 +78,25 @@ void install_branch_config(int flag, const char *local, const char *origin, cons\n \n \tif (flag & BRANCH_CONFIG_VERBOSE) {\n \t\tif (remote_is_branch && origin)\n-\t\t\tprintf(rebasing ?\n-\t\t\t       \"Branch %s set up to track remote branch %s from %s by rebasing.\\n\" :\n-\t\t\t       \"Branch %s set up to track remote branch %s from %s.\\n\",\n-\t\t\t       local, shortname, origin);\n+\t\t\tprintf_ln(rebasing ?\n+\t\t\t\t  _(\"Branch %s set up to track remote branch %s from %s by rebasing.\") :\n+\t\t\t\t  _(\"Branch %s set up to track remote branch %s from %s.\"),\n+\t\t\t\t  local, shortname, origin);\n \t\telse if (remote_is_branch && !origin)\n-\t\t\tprintf(rebasing ?\n-\t\t\t       \"Branch %s set up to track local branch %s by rebasing.\\n\" :\n-\t\t\t       \"Branch %s set up to track local branch %s.\\n\",\n-\t\t\t       local, shortname);\n+\t\t\tprintf_ln(rebasing ?\n+\t\t\t\t  _(\"Branch %s set up to track local branch %s by rebasing.\") :\n+\t\t\t\t  _(\"Branch %s set up to track local branch %s.\"),\n+\t\t\t\t  local, shortname);\n \t\telse if (!remote_is_branch && origin)\n-\t\t\tprintf(rebasing ?\n-\t\t\t       \"Branch %s set up to track remote ref %s by rebasing.\\n\" :\n-\t\t\t       \"Branch %s set up to track remote ref %s.\\n\",\n-\t\t\t       local, remote);\n+\t\t\tprintf_ln(rebasing ?\n+\t\t\t\t  _(\"Branch %s set up to track remote ref %s by rebasing.\") :\n+\t\t\t\t  _(\"Branch %s set up to track remote ref %s.\"),\n+\t\t\t\t  local, remote);\n \t\telse if (!remote_is_branch && !origin)\n-\t\t\tprintf(rebasing ?\n-\t\t\t       \"Branch %s set up to track local ref %s by rebasing.\\n\" :\n-\t\t\t       \"Branch %s set up to track local ref %s.\\n\",\n-\t\t\t       local, remote);\n+\t\t\tprintf_ln(rebasing ?\n+\t\t\t\t  _(\"Branch %s set up to track local ref %s by rebasing.\") :\n+\t\t\t\t  _(\"Branch %s set up to track local ref %s.\"),\n+\t\t\t\t  local, remote);\n \t\telse\n \t\t\tdie(\"BUG: impossible combination of %d and %p\",\n \t\t\t    remote_is_branch, origin);\n@@ -115,7 +115,7 @@ static int setup_tracking(const char *new_ref, const char *orig_ref,\n \tint config_flags = quiet ? 0 : BRANCH_CONFIG_VERBOSE;\n \n \tif (strlen(new_ref) > 1024 - 7 - 7 - 1)\n-\t\treturn error(\"Tracking not set up: name too long: %s\",\n+\t\treturn error(_(\"Tracking not set up: name too long: %s\"),\n \t\t\t\tnew_ref);\n \n \tmemset(&tracking, 0, sizeof(tracking));\n@@ -134,7 +134,7 @@ static int setup_tracking(const char *new_ref, const char *orig_ref,\n \t\t}\n \n \tif (tracking.matches > 1)\n-\t\treturn error(\"Not tracking: ambiguous information for ref %s\",\n+\t\treturn error(_(\"Not tracking: ambiguous information for ref %s\"),\n \t\t\t\torig_ref);\n \n \tinstall_branch_config(config_flags, new_ref, tracking.remote,\n@@ -179,12 +179,12 @@ int validate_new_branchname(const char *name, struct strbuf *ref,\n \t\t\t    int force, int attr_only)\n {\n \tif (strbuf_check_branch_ref(ref, name))\n-\t\tdie(\"'%s' is not a valid branch name.\", name);\n+\t\tdie(_(\"'%s' is not a valid branch name.\"), name);\n \n \tif (!ref_exists(ref->buf))\n \t\treturn 0;\n \telse if (!force && !attr_only)\n-\t\tdie(\"A branch named '%s' already exists.\", ref->buf + strlen(\"refs/heads/\"));\n+\t\tdie(_(\"A branch named '%s' already exists.\"), ref->buf + strlen(\"refs/heads/\"));\n \n \tif (!attr_only) {\n \t\tconst char *head;\n@@ -192,7 +192,7 @@ int validate_new_branchname(const char *name, struct strbuf *ref,\n \n \t\thead = resolve_ref_unsafe(\"HEAD\", sha1, 0, NULL);\n \t\tif (!is_bare_repository() && head && !strcmp(head, ref->buf))\n-\t\t\tdie(\"Cannot force update the current branch.\");\n+\t\t\tdie(_(\"Cannot force update the current branch.\"));\n \t}\n \treturn 1;\n }\n@@ -247,7 +247,7 @@ void create_branch(const char *head,\n \t\t\t}\n \t\t\tdie(_(upstream_missing), start_name);\n \t\t}\n-\t\tdie(\"Not a valid object name: '%s'.\", start_name);\n+\t\tdie(_(\"Not a valid object name: '%s'.\"), start_name);\n \t}\n \n \tswitch (dwim_ref(start_name, strlen(start_name), sha1, &real_ref)) {\n@@ -267,18 +267,18 @@ void create_branch(const char *head,\n \t\t}\n \t\tbreak;\n \tdefault:\n-\t\tdie(\"Ambiguous object name: '%s'.\", start_name);\n+\t\tdie(_(\"Ambiguous object name: '%s'.\"), start_name);\n \t\tbreak;\n \t}\n \n \tif ((commit = lookup_commit_reference(sha1)) == NULL)\n-\t\tdie(\"Not a valid branch point: '%s'.\", start_name);\n+\t\tdie(_(\"Not a valid branch point: '%s'.\"), start_name);\n \thashcpy(sha1, commit->object.sha1);\n \n \tif (!dont_change_ref) {\n \t\tlock = lock_any_ref_for_update(ref.buf, NULL, 0);\n \t\tif (!lock)\n-\t\t\tdie_errno(\"Failed to lock ref for update\");\n+\t\t\tdie_errno(_(\"Failed to lock ref for update\"));\n \t}\n \n \tif (reflog)\n@@ -296,7 +296,7 @@ void create_branch(const char *head,\n \n \tif (!dont_change_ref)\n \t\tif (write_ref_sha1(lock, sha1, msg) < 0)\n-\t\t\tdie_errno(\"Failed to write ref\");\n+\t\t\tdie_errno(_(\"Failed to write ref\"));\n \n \tstrbuf_release(&ref);\n \tfree(real_ref);\n-- \n1.8.2.1.350.gd29561d\n"},{"id":"214431","messageId":"7vsj2rnm5z.fsf@alter.siamese.dyndns.org","threadId":"33496","inReplyTo":"e31669b2dc24ac07de4ed23e00d5a38de5fcda8b.1366082959.git.worldhello.net@gmail.com","subject":"Re: [PATCH v3] i18n: branch: mark strings for translation","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-04-16T04:18:16Z","receivedAt":"2013-04-16T04:18:16Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thanks, both.  Will replace what is queued with this version.\n"}]}