{"thread":{"id":"39233","subject":"[PATCH] Fixed a translation error","startedAt":"2015-05-04T11:16:04Z","lastAt":"2015-05-04T21:29:05Z","messageCount":3,"participants":["Alangi Derick","Jonathan Nieder","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"260512","messageId":"554766e9.b30db50a.72e3.ffff8bbe@mx.google.com","threadId":"39233","inReplyTo":null,"subject":"[PATCH] Fixed a translation error","fromName":"Alangi Derick","fromEmail":"alangiderick@gmail.com","sentAt":"2015-05-04T11:16:04Z","receivedAt":"2015-05-04T11:16:04Z","isPatch":true,"sender":{"key":"alangiderick@gmail.com","avatar":"https://gravatar.com/avatar/f5878e69e83b4cf7ed499336c4a114dc2cb253253bc57c9b8ffcf0e129320795?d=mp&s=160"},"body":"Signed-off-by: Alangi Derick <alangiderick@gmail.com>\n---\n builtin/config.c | 34 +++++++++++++++++-----------------\n 1 file changed, 17 insertions(+), 17 deletions(-)\n\ndiff --git a/builtin/config.c b/builtin/config.c\nindex d32c532..2b6bf0a 100644\n--- a/builtin/config.c\n+++ b/builtin/config.c\n@@ -85,7 +85,7 @@ static struct option builtin_config_options[] = {\n static void check_argc(int argc, int min, int max) {\n \tif (argc >= min && argc <= max)\n \t\treturn;\n-\terror(\"wrong number of arguments\");\n+\terror(_(\"wrong number of arguments\"));\n \tusage_with_options(builtin_config_usage, builtin_config_options);\n }\n \n@@ -366,10 +366,10 @@ static int get_colorbool(const char *var, int print)\n static void check_write(void)\n {\n \tif (given_config_source.use_stdin)\n-\t\tdie(\"writing to stdin is not supported\");\n+\t\tdie(_(\"writing to stdin is not supported\"));\n \n \tif (given_config_source.blob)\n-\t\tdie(\"writing config blobs is not supported\");\n+\t\tdie(_(\"writing config blobs is not supported\"));\n }\n \n struct urlmatch_current_candidate_value {\n@@ -412,7 +412,7 @@ static int get_urlmatch(const char *var, const char *url)\n \tconfig.cb = &values;\n \n \tif (!url_normalize(url, &config.url))\n-\t\tdie(\"%s\", config.url.err);\n+\t\tdie(_(\"%s\"), config.url.err);\n \n \tconfig.section = xstrdup_tolower(var);\n \tsection_tail = strchr(config.section, '.');\n@@ -477,7 +477,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)\n \n \tif (use_global_config + use_system_config + use_local_config +\n \t    !!given_config_source.file + !!given_config_source.blob > 1) {\n-\t\terror(\"only one config file at a time.\");\n+\t\terror(_(\"only one config file at a time.\"));\n \t\tusage_with_options(builtin_config_usage, builtin_config_options);\n \t}\n \n@@ -500,7 +500,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)\n \t\t\t * location; error out even if XDG_CONFIG_HOME\n \t\t\t * is set and points at a sane location.\n \t\t\t */\n-\t\t\tdie(\"$HOME not set\");\n+\t\t\tdie(_(\"$HOME not set\"));\n \n \t\tif (access_or_warn(user_config, R_OK, 0) &&\n \t\t    xdg_config && !access_or_warn(xdg_config, R_OK, 0))\n@@ -530,17 +530,17 @@ int cmd_config(int argc, const char **argv, const char *prefix)\n \t}\n \n \tif (HAS_MULTI_BITS(types)) {\n-\t\terror(\"only one type at a time.\");\n+\t\terror(_(\"only one type at a time.\"));\n \t\tusage_with_options(builtin_config_usage, builtin_config_options);\n \t}\n \n \tif ((actions & (ACTION_GET_COLOR|ACTION_GET_COLORBOOL)) && types) {\n-\t\terror(\"--get-color and variable type are incoherent\");\n+\t\terror(_(\"--get-color and variable type are incoherent\"));\n \t\tusage_with_options(builtin_config_usage, builtin_config_options);\n \t}\n \n \tif (HAS_MULTI_BITS(actions)) {\n-\t\terror(\"only one action at a time.\");\n+\t\terror(_(\"only one action at a time.\"));\n \t\tusage_with_options(builtin_config_usage, builtin_config_options);\n \t}\n \tif (actions == 0)\n@@ -561,7 +561,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)\n \t\t\t\tdie_errno(\"unable to read config file '%s'\",\n \t\t\t\t\t  given_config_source.file);\n \t\t\telse\n-\t\t\t\tdie(\"error processing config file(s)\");\n+\t\t\t\tdie(_(\"error processing config file(s)\"));\n \t\t}\n \t}\n \telse if (actions == ACTION_EDIT) {\n@@ -569,11 +569,11 @@ int cmd_config(int argc, const char **argv, const char *prefix)\n \n \t\tcheck_argc(argc, 0, 0);\n \t\tif (!given_config_source.file && nongit)\n-\t\t\tdie(\"not in a git directory\");\n+\t\t\tdie(_(\"not in a git directory\"));\n \t\tif (given_config_source.use_stdin)\n-\t\t\tdie(\"editing stdin is not supported\");\n+\t\t\tdie(_(\"editing stdin is not supported\"));\n \t\tif (given_config_source.blob)\n-\t\t\tdie(\"editing blobs is not supported\");\n+\t\t\tdie(_(\"editing blobs is not supported\"));\n \t\tgit_config(git_default_config, NULL);\n \t\tconfig_file = xstrdup(given_config_source.file ?\n \t\t\t\t      given_config_source.file : git_path(\"config\"));\n@@ -598,8 +598,8 @@ int cmd_config(int argc, const char **argv, const char *prefix)\n \t\tvalue = normalize_value(argv[0], argv[1]);\n \t\tret = git_config_set_in_file(given_config_source.file, argv[0], value);\n \t\tif (ret == CONFIG_NOTHING_SET)\n-\t\t\terror(\"cannot overwrite multiple values with a single value\\n\"\n-\t\t\t\"       Use a regexp, --add or --replace-all to change %s.\", argv[0]);\n+\t\t\terror(_(\"cannot overwrite multiple values with a single value\\n\"\n+\t\t\t\"       Use a regexp, --add or --replace-all to change %s.\"), argv[0]);\n \t\treturn ret;\n \t}\n \telse if (actions == ACTION_SET_ALL) {\n@@ -669,7 +669,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)\n \t\tif (ret < 0)\n \t\t\treturn ret;\n \t\tif (ret == 0)\n-\t\t\tdie(\"No such section!\");\n+\t\t\tdie(_(\"No such section!\"));\n \t}\n \telse if (actions == ACTION_REMOVE_SECTION) {\n \t\tint ret;\n@@ -680,7 +680,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)\n \t\tif (ret < 0)\n \t\t\treturn ret;\n \t\tif (ret == 0)\n-\t\t\tdie(\"No such section!\");\n+\t\t\tdie(_(\"No such section!\"));\n \t}\n \telse if (actions == ACTION_GET_COLOR) {\n \t\tcheck_argc(argc, 1, 2);\n-- \n2.4.0.5.g7a7787e.dirty\n"},{"id":"260553","messageId":"20150504211839.GX5467@google.com","threadId":"39233","inReplyTo":"554766e9.b30db50a.72e3.ffff8bbe@mx.google.com","subject":"Re: [PATCH] Fixed a translation error","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2015-05-04T21:18:39Z","receivedAt":"2015-05-04T21:18:39Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi,\n\nAlangi Derick wrote:\n\n> [To: unlisted-recipients: no To-header on input <;]\n\nPlease don't do that.\n\nWhat mailer do you use to send patches?  Others on the list using the\nsame mailer might be able to help with configuration tips.\n\n> [Subject: [PATCH] Fixed a translation error]\n\nThe above commit description is vague and confusing: in fact, this\npatch doesn't fix a translation error.  Instead, the commit\ndescription should explain the purpose of the change in such a way as\nto make it clear why a person might want to apply it.\n\nMore details are in Documentation/SubmittingPatches.\n\n> Signed-off-by: Alangi Derick <alangiderick@gmail.com>\n\nThanks.\n\n[...]\n> +++ b/builtin/config.c\n\nYes, this is an okay command to start with.  Some messages are already\ntranslated in this file, so it's a good example of a command that\ncurrently presents an inconsistent interface in some languages.\n\n[...]\n> @@ -412,7 +412,7 @@ static int get_urlmatch(const char *var, const char *url)\n>  \tconfig.cb = &values;\n>  \n>  \tif (!url_normalize(url, &config.url))\n> -\t\tdie(\"%s\", config.url.err);\n> +\t\tdie(_(\"%s\"), config.url.err);\n\nThis change is subtle.  It lets a translator replace the format \"%s\"\nwith something else --- that wouldn't be useful in any language, so\nthis string should not be marked for translation.\n\nThe underlying message in config.url.err is from urlmatch.c and is\nalready translated.\n\nThere are two more strings that need to be marked for translation in\nthis file: \"Invalid key pattern: %s\" and \"Invalid pattern: %s\".\nHere's a preparatory patch to make that output more consistent.\n\nOne more piece of advice: when working on many similar patches like\nthis, a good strategy is to just send out one and get review for it.\nWhen it has been reviewed and is in good shape, you can move on to\npreparing and polishing the next patch.  The first few reviewed\npatches can be used a template for the rest.\n\nIn other words, only once it's very clear that all the patches are\nlikely to be in good shape is it time to prepare and send out all of\nthem.  By working through only one patch at a time in a collection of\nsimilar, unfinished patches, you avoid wasting time re-writing all the\npatches in response to feedback and avoid overwhelming reviewers by\nasking them to keep track of many reviews at once.  Most comments on\none patch will also apply to all the rest and the conversation only\nhas to happen once.\n\nThanks,\nJonathan\n\n-- >8 --\nSubject: config: use error() instead of fprintf(stderr, ...)\n\nThe die() / error() / warning() helpers put a fatal: / error: /\nwarning: prefix in front of the error message they print describing\nthe message's severity, which users are likely to be accustomed to\nseeing these days.\n\nThis change will also be useful when marking the message for\ntranslation: the argument to error() includes no newline at the end,\nso it is less fussy for translators to translate without lines running\ntogether in the translated output.\n\nWhile we're here, start the error messages with a lowercase letter to\nmatch the usual typography of error messages.\n\nA quick web search and a code search at codesearch.debian.net finds no\nscripts trying to parse these error messages, so this change should be\nsafe.\n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n builtin/config.c | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin/config.c b/builtin/config.c\nindex d32c532..89f3208 100644\n--- a/builtin/config.c\n+++ b/builtin/config.c\n@@ -193,7 +193,7 @@ static int get_value(const char *key_, const char *regex_)\n \n \t\tkey_regexp = (regex_t*)xmalloc(sizeof(regex_t));\n \t\tif (regcomp(key_regexp, key, REG_EXTENDED)) {\n-\t\t\tfprintf(stderr, \"Invalid key pattern: %s\\n\", key_);\n+\t\t\terror(\"invalid key pattern: %s\", key_);\n \t\t\tfree(key_regexp);\n \t\t\tkey_regexp = NULL;\n \t\t\tret = CONFIG_INVALID_PATTERN;\n@@ -214,7 +214,7 @@ static int get_value(const char *key_, const char *regex_)\n \n \t\tregexp = (regex_t*)xmalloc(sizeof(regex_t));\n \t\tif (regcomp(regexp, regex_, REG_EXTENDED)) {\n-\t\t\tfprintf(stderr, \"Invalid pattern: %s\\n\", regex_);\n+\t\t\terror(\"invalid pattern: %s\", regex_);\n \t\t\tfree(regexp);\n \t\t\tregexp = NULL;\n \t\t\tret = CONFIG_INVALID_PATTERN;\n-- \n"},{"id":"260554","messageId":"xmqqlhh4owv2.fsf@gitster.dls.corp.google.com","threadId":"39233","inReplyTo":"20150504211839.GX5467@google.com","subject":"Re: [PATCH] Fixed a translation error","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-05-04T21:29:05Z","receivedAt":"2015-05-04T21:29:05Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jonathan Nieder <jrnieder@gmail.com> writes:\n\n> While we're here, start the error messages with a lowercase letter to\n> match the usual typography of error messages.\n>\n> A quick web search and a code search at codesearch.debian.net finds no\n> scripts trying to parse these error messages, so this change should be\n> safe.\n\nVery well thought through and nicely written.\n\nI am tempted to pick this patch up and queue it on its own.  Alengi,\nif you want to add _() markings to this file, perhaps it is a good\nidea to base your patch relative to (i.e. on top of) Jonathan's\npatch.\n\nThanks.\n\n>\n> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>\n> ---\n>  builtin/config.c | 4 ++--\n>  1 file changed, 2 insertions(+), 2 deletions(-)\n>\n> diff --git a/builtin/config.c b/builtin/config.c\n> index d32c532..89f3208 100644\n> --- a/builtin/config.c\n> +++ b/builtin/config.c\n> @@ -193,7 +193,7 @@ static int get_value(const char *key_, const char *regex_)\n>  \n>  \t\tkey_regexp = (regex_t*)xmalloc(sizeof(regex_t));\n>  \t\tif (regcomp(key_regexp, key, REG_EXTENDED)) {\n> -\t\t\tfprintf(stderr, \"Invalid key pattern: %s\\n\", key_);\n> +\t\t\terror(\"invalid key pattern: %s\", key_);\n>  \t\t\tfree(key_regexp);\n>  \t\t\tkey_regexp = NULL;\n>  \t\t\tret = CONFIG_INVALID_PATTERN;\n> @@ -214,7 +214,7 @@ static int get_value(const char *key_, const char *regex_)\n>  \n>  \t\tregexp = (regex_t*)xmalloc(sizeof(regex_t));\n>  \t\tif (regcomp(regexp, regex_, REG_EXTENDED)) {\n> -\t\t\tfprintf(stderr, \"Invalid pattern: %s\\n\", regex_);\n> +\t\t\terror(\"invalid pattern: %s\", regex_);\n>  \t\t\tfree(regexp);\n>  \t\t\tregexp = NULL;\n>  \t\t\tret = CONFIG_INVALID_PATTERN;\n"}]}