{"thread":{"id":"37254","subject":"[PATCH] config.c: mark error and warnings strings for translation","startedAt":"2014-07-31T11:31:23Z","lastAt":"2014-07-31T12:18:32Z","messageCount":3,"participants":["Matthieu Moy","Tanay Abhra"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"247029","messageId":"1406806283-21571-1-git-send-email-Matthieu.Moy@imag.fr","threadId":"37254","inReplyTo":null,"subject":"[PATCH] config.c: mark error and warnings strings for translation","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2014-07-31T11:31:23Z","receivedAt":"2014-07-31T11:31:23Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n---\nNoticed while reviewing Tanay's patches, but this one is independant\nfrom his series, both syntactically and semantically.\n\n config.c | 20 ++++++++++----------\n 1 file changed, 10 insertions(+), 10 deletions(-)\n\ndiff --git a/config.c b/config.c\nindex a191328..76eeb63 100644\n--- a/config.c\n+++ b/config.c\n@@ -457,9 +457,9 @@ static int git_parse_source(config_fn_t fn, void *data)\n \t\t\tbreak;\n \t}\n \tif (cf->die_on_error)\n-\t\tdie(\"bad config file line %d in %s\", cf->linenr, cf->name);\n+\t\tdie(_(\"bad config file line %d in %s\"), cf->linenr, cf->name);\n \telse\n-\t\treturn error(\"bad config file line %d in %s\", cf->linenr, cf->name);\n+\t\treturn error(_(\"bad config file line %d in %s\"), cf->linenr, cf->name);\n }\n \n static int parse_unit_factor(const char *end, uintmax_t *val)\n@@ -575,9 +575,9 @@ static void die_bad_number(const char *name, const char *value)\n \t\tvalue = \"\";\n \n \tif (cf && cf->name)\n-\t\tdie(\"bad numeric config value '%s' for '%s' in %s: %s\",\n+\t\tdie(_(\"bad numeric config value '%s' for '%s' in %s: %s\"),\n \t\t    value, name, cf->name, reason);\n-\tdie(\"bad numeric config value '%s' for '%s': %s\", value, name, reason);\n+\tdie(_(\"bad numeric config value '%s' for '%s': %s\"), value, name, reason);\n }\n \n int git_config_int(const char *name, const char *value)\n@@ -662,7 +662,7 @@ int git_config_pathname(const char **dest, const char *var, const char *value)\n \t\treturn config_error_nonbool(var);\n \t*dest = expand_user_path(value);\n \tif (!*dest)\n-\t\tdie(\"Failed to expand user dir in: '%s'\", value);\n+\t\tdie(_(\"Failed to expand user dir in: '%s'\"), value);\n \treturn 0;\n }\n \n@@ -740,7 +740,7 @@ static int git_default_core_config(const char *var, const char *value)\n \t\tif (level == -1)\n \t\t\tlevel = Z_DEFAULT_COMPRESSION;\n \t\telse if (level < 0 || level > Z_BEST_COMPRESSION)\n-\t\t\tdie(\"bad zlib compression level %d\", level);\n+\t\t\tdie(_(\"bad zlib compression level %d\"), level);\n \t\tzlib_compression_level = level;\n \t\tzlib_compression_seen = 1;\n \t\treturn 0;\n@@ -751,7 +751,7 @@ static int git_default_core_config(const char *var, const char *value)\n \t\tif (level == -1)\n \t\t\tlevel = Z_DEFAULT_COMPRESSION;\n \t\telse if (level < 0 || level > Z_BEST_COMPRESSION)\n-\t\t\tdie(\"bad zlib compression level %d\", level);\n+\t\t\tdie(_(\"bad zlib compression level %d\"), level);\n \t\tcore_compression_level = level;\n \t\tcore_compression_seen = 1;\n \t\tif (!zlib_compression_seen)\n@@ -873,7 +873,7 @@ static int git_default_core_config(const char *var, const char *value)\n \t\telse if (!strcmp(value, \"link\"))\n \t\t\tobject_creation_mode = OBJECT_CREATION_USES_HARDLINKS;\n \t\telse\n-\t\t\tdie(\"Invalid mode for object creation: %s\", value);\n+\t\t\tdie(_(\"Invalid mode for object creation: %s\"), value);\n \t\treturn 0;\n \t}\n \n@@ -1173,7 +1173,7 @@ int git_config_early(config_fn_t fn, void *data, const char *repo_config)\n \n \tswitch (git_config_from_parameters(fn, data)) {\n \tcase -1: /* error */\n-\t\tdie(\"unable to parse command-line config\");\n+\t\tdie(_(\"unable to parse command-line config\"));\n \t\tbreak;\n \tcase 0: /* found nothing */\n \t\tbreak;\n@@ -1514,7 +1514,7 @@ static int store_aux(const char *key, const char *value, void *cb)\n \tcase KEY_SEEN:\n \t\tif (matches(key, value)) {\n \t\t\tif (store.seen == 1 && store.multi_replace == 0) {\n-\t\t\t\twarning(\"%s has multiple values\", key);\n+\t\t\t\twarning(_(\"%s has multiple values\"), key);\n \t\t\t}\n \n \t\t\tALLOC_GROW(store.offset, store.seen + 1,\n-- \n2.0.2.737.gfb43bde\n"},{"id":"247035","messageId":"53DA3269.40901@gmail.com","threadId":"37254","inReplyTo":"1406806283-21571-1-git-send-email-Matthieu.Moy@imag.fr","subject":"Re: [PATCH] config.c: mark error and warnings strings for translation","fromName":"Tanay Abhra","fromEmail":"tanayabh@gmail.com","sentAt":"2014-07-31T12:11:21Z","receivedAt":"2014-07-31T12:11:21Z","isPatch":true,"sender":{"key":"tanayabh@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2097229?v=4"},"body":"On 7/31/2014 5:01 PM, Matthieu Moy wrote:\n> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n> ---\n> Noticed while reviewing Tanay's patches, but this one is independant\n> from his series, both syntactically and semantically.\n> \n>  config.c | 20 ++++++++++----------\n>  1 file changed, 10 insertions(+), 10 deletions(-)\n> \n> diff --git a/config.c b/config.c\n> index a191328..76eeb63 100644\n> --- a/config.c\n> +++ b/config.c\n> @@ -457,9 +457,9 @@ static int git_parse_source(config_fn_t fn, void *data)\n>  \t\t\tbreak;\n>  \t}\n>  \tif (cf->die_on_error)\n> -\t\tdie(\"bad config file line %d in %s\", cf->linenr, cf->name);\n> +\t\tdie(_(\"bad config file line %d in %s\"), cf->linenr, cf->name);\n>  \telse\n> -\t\treturn error(\"bad config file line %d in %s\", cf->linenr, cf->name);\n> +\t\treturn error(_(\"bad config file line %d in %s\"), cf->linenr, cf->name);\n\nCan I package your patch with mine in which I am going to change the\nerror message to print the variable name also?\n\n>  }\n>  \n>  static int parse_unit_factor(const char *end, uintmax_t *val)\n> @@ -575,9 +575,9 @@ static void die_bad_number(const char *name, const char *value)\n>  \t\tvalue = \"\";\n>  \n>  \tif (cf && cf->name)\n> -\t\tdie(\"bad numeric config value '%s' for '%s' in %s: %s\",\n> +\t\tdie(_(\"bad numeric config value '%s' for '%s' in %s: %s\"),\n>  \t\t    value, name, cf->name, reason);\n> -\tdie(\"bad numeric config value '%s' for '%s': %s\", value, name, reason);\n> +\tdie(_(\"bad numeric config value '%s' for '%s': %s\"), value, name, reason);\n>  }\n>  \n>  int git_config_int(const char *name, const char *value)\n> @@ -662,7 +662,7 @@ int git_config_pathname(const char **dest, const char *var, const char *value)\n>  \t\treturn config_error_nonbool(var);\n>  \t*dest = expand_user_path(value);\n>  \tif (!*dest)\n> -\t\tdie(\"Failed to expand user dir in: '%s'\", value);\n> +\t\tdie(_(\"Failed to expand user dir in: '%s'\"), value);\n\nnit : error messages start with a small letter. same case below for \"Invalid\". ;)\n\n>  \treturn 0;\n>  }\n>  \n> @@ -740,7 +740,7 @@ static int git_default_core_config(const char *var, const char *value)\n>  \t\tif (level == -1)\n>  \t\t\tlevel = Z_DEFAULT_COMPRESSION;\n>  \t\telse if (level < 0 || level > Z_BEST_COMPRESSION)\n> -\t\t\tdie(\"bad zlib compression level %d\", level);\n> +\t\t\tdie(_(\"bad zlib compression level %d\"), level);\n>  \t\tzlib_compression_level = level;\n>  \t\tzlib_compression_seen = 1;\n>  \t\treturn 0;\n> @@ -751,7 +751,7 @@ static int git_default_core_config(const char *var, const char *value)\n>  \t\tif (level == -1)\n>  \t\t\tlevel = Z_DEFAULT_COMPRESSION;\n>  \t\telse if (level < 0 || level > Z_BEST_COMPRESSION)\n> -\t\t\tdie(\"bad zlib compression level %d\", level);\n> +\t\t\tdie(_(\"bad zlib compression level %d\"), level);\n>  \t\tcore_compression_level = level;\n>  \t\tcore_compression_seen = 1;\n>  \t\tif (!zlib_compression_seen)\n> @@ -873,7 +873,7 @@ static int git_default_core_config(const char *var, const char *value)\n>  \t\telse if (!strcmp(value, \"link\"))\n>  \t\t\tobject_creation_mode = OBJECT_CREATION_USES_HARDLINKS;\n>  \t\telse\n> -\t\t\tdie(\"Invalid mode for object creation: %s\", value);\n> +\t\t\tdie(_(\"Invalid mode for object creation: %s\"), value);\n>  \t\treturn 0;\n>  \t}\n>  \n> @@ -1173,7 +1173,7 @@ int git_config_early(config_fn_t fn, void *data, const char *repo_config)\n>  \n>  \tswitch (git_config_from_parameters(fn, data)) {\n>  \tcase -1: /* error */\n> -\t\tdie(\"unable to parse command-line config\");\n> +\t\tdie(_(\"unable to parse command-line config\"));\n>  \t\tbreak;\n>  \tcase 0: /* found nothing */\n>  \t\tbreak;\n> @@ -1514,7 +1514,7 @@ static int store_aux(const char *key, const char *value, void *cb)\n>  \tcase KEY_SEEN:\n>  \t\tif (matches(key, value)) {\n>  \t\t\tif (store.seen == 1 && store.multi_replace == 0) {\n> -\t\t\t\twarning(\"%s has multiple values\", key);\n> +\t\t\t\twarning(_(\"%s has multiple values\"), key);\n>  \t\t\t}\n>  \n>  \t\t\tALLOC_GROW(store.offset, store.seen + 1,\n> \n"},{"id":"247037","messageId":"vpq61idafhj.fsf@anie.imag.fr","threadId":"37254","inReplyTo":"53DA3269.40901@gmail.com","subject":"Re: [PATCH] config.c: mark error and warnings strings for translation","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2014-07-31T12:18:32Z","receivedAt":"2014-07-31T12:18:32Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Tanay Abhra <tanayabh@gmail.com> writes:\n\n> On 7/31/2014 5:01 PM, Matthieu Moy wrote:\n>> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n>> ---\n>> Noticed while reviewing Tanay's patches, but this one is independant\n>> from his series, both syntactically and semantically.\n>> \n>>  config.c | 20 ++++++++++----------\n>>  1 file changed, 10 insertions(+), 10 deletions(-)\n>> \n>> diff --git a/config.c b/config.c\n>> index a191328..76eeb63 100644\n>> --- a/config.c\n>> +++ b/config.c\n>> @@ -457,9 +457,9 @@ static int git_parse_source(config_fn_t fn, void *data)\n>>  \t\t\tbreak;\n>>  \t}\n>>  \tif (cf->die_on_error)\n>> -\t\tdie(\"bad config file line %d in %s\", cf->linenr, cf->name);\n>> +\t\tdie(_(\"bad config file line %d in %s\"), cf->linenr, cf->name);\n>>  \telse\n>> -\t\treturn error(\"bad config file line %d in %s\", cf->linenr, cf->name);\n>> +\t\treturn error(_(\"bad config file line %d in %s\"), cf->linenr, cf->name);\n>\n> Can I package your patch with mine in which I am going to change the\n> error message to print the variable name also?\n\nYes, you can include it as PATCH 1 for example, and then build on top.\n\n>> @@ -662,7 +662,7 @@ int git_config_pathname(const char **dest, const char *var, const char *value)\n>>  \t\treturn config_error_nonbool(var);\n>>  \t*dest = expand_user_path(value);\n>>  \tif (!*dest)\n>> -\t\tdie(\"Failed to expand user dir in: '%s'\", value);\n>> +\t\tdie(_(\"Failed to expand user dir in: '%s'\"), value);\n>\n> nit : error messages start with a small letter. same case below for \"Invalid\". ;)\n\nIndeed. Then I'm letting you continue on the patch.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"}]}