All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] config.c: mark error and warnings strings for translation
@ 2014-07-31 11:31 Matthieu Moy
  2014-07-31 12:11 ` Tanay Abhra
  0 siblings, 1 reply; 3+ messages in thread
From: Matthieu Moy @ 2014-07-31 11:31 UTC (permalink / raw)
  To: git, gitster; +Cc: tanayabh, Matthieu Moy

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
---
Noticed while reviewing Tanay's patches, but this one is independant
from his series, both syntactically and semantically.

 config.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/config.c b/config.c
index a191328..76eeb63 100644
--- a/config.c
+++ b/config.c
@@ -457,9 +457,9 @@ static int git_parse_source(config_fn_t fn, void *data)
 			break;
 	}
 	if (cf->die_on_error)
-		die("bad config file line %d in %s", cf->linenr, cf->name);
+		die(_("bad config file line %d in %s"), cf->linenr, cf->name);
 	else
-		return error("bad config file line %d in %s", cf->linenr, cf->name);
+		return error(_("bad config file line %d in %s"), cf->linenr, cf->name);
 }
 
 static int parse_unit_factor(const char *end, uintmax_t *val)
@@ -575,9 +575,9 @@ static void die_bad_number(const char *name, const char *value)
 		value = "";
 
 	if (cf && cf->name)
-		die("bad numeric config value '%s' for '%s' in %s: %s",
+		die(_("bad numeric config value '%s' for '%s' in %s: %s"),
 		    value, name, cf->name, reason);
-	die("bad numeric config value '%s' for '%s': %s", value, name, reason);
+	die(_("bad numeric config value '%s' for '%s': %s"), value, name, reason);
 }
 
 int git_config_int(const char *name, const char *value)
@@ -662,7 +662,7 @@ int git_config_pathname(const char **dest, const char *var, const char *value)
 		return config_error_nonbool(var);
 	*dest = expand_user_path(value);
 	if (!*dest)
-		die("Failed to expand user dir in: '%s'", value);
+		die(_("Failed to expand user dir in: '%s'"), value);
 	return 0;
 }
 
@@ -740,7 +740,7 @@ static int git_default_core_config(const char *var, const char *value)
 		if (level == -1)
 			level = Z_DEFAULT_COMPRESSION;
 		else if (level < 0 || level > Z_BEST_COMPRESSION)
-			die("bad zlib compression level %d", level);
+			die(_("bad zlib compression level %d"), level);
 		zlib_compression_level = level;
 		zlib_compression_seen = 1;
 		return 0;
@@ -751,7 +751,7 @@ static int git_default_core_config(const char *var, const char *value)
 		if (level == -1)
 			level = Z_DEFAULT_COMPRESSION;
 		else if (level < 0 || level > Z_BEST_COMPRESSION)
-			die("bad zlib compression level %d", level);
+			die(_("bad zlib compression level %d"), level);
 		core_compression_level = level;
 		core_compression_seen = 1;
 		if (!zlib_compression_seen)
@@ -873,7 +873,7 @@ static int git_default_core_config(const char *var, const char *value)
 		else if (!strcmp(value, "link"))
 			object_creation_mode = OBJECT_CREATION_USES_HARDLINKS;
 		else
-			die("Invalid mode for object creation: %s", value);
+			die(_("Invalid mode for object creation: %s"), value);
 		return 0;
 	}
 
@@ -1173,7 +1173,7 @@ int git_config_early(config_fn_t fn, void *data, const char *repo_config)
 
 	switch (git_config_from_parameters(fn, data)) {
 	case -1: /* error */
-		die("unable to parse command-line config");
+		die(_("unable to parse command-line config"));
 		break;
 	case 0: /* found nothing */
 		break;
@@ -1514,7 +1514,7 @@ static int store_aux(const char *key, const char *value, void *cb)
 	case KEY_SEEN:
 		if (matches(key, value)) {
 			if (store.seen == 1 && store.multi_replace == 0) {
-				warning("%s has multiple values", key);
+				warning(_("%s has multiple values"), key);
 			}
 
 			ALLOC_GROW(store.offset, store.seen + 1,
-- 
2.0.2.737.gfb43bde

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] config.c: mark error and warnings strings for translation
  2014-07-31 11:31 [PATCH] config.c: mark error and warnings strings for translation Matthieu Moy
@ 2014-07-31 12:11 ` Tanay Abhra
  2014-07-31 12:18   ` Matthieu Moy
  0 siblings, 1 reply; 3+ messages in thread
From: Tanay Abhra @ 2014-07-31 12:11 UTC (permalink / raw)
  To: Matthieu Moy, git, gitster

On 7/31/2014 5:01 PM, Matthieu Moy wrote:
> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
> ---
> Noticed while reviewing Tanay's patches, but this one is independant
> from his series, both syntactically and semantically.
> 
>  config.c | 20 ++++++++++----------
>  1 file changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/config.c b/config.c
> index a191328..76eeb63 100644
> --- a/config.c
> +++ b/config.c
> @@ -457,9 +457,9 @@ static int git_parse_source(config_fn_t fn, void *data)
>  			break;
>  	}
>  	if (cf->die_on_error)
> -		die("bad config file line %d in %s", cf->linenr, cf->name);
> +		die(_("bad config file line %d in %s"), cf->linenr, cf->name);
>  	else
> -		return error("bad config file line %d in %s", cf->linenr, cf->name);
> +		return error(_("bad config file line %d in %s"), cf->linenr, cf->name);

Can I package your patch with mine in which I am going to change the
error message to print the variable name also?

>  }
>  
>  static int parse_unit_factor(const char *end, uintmax_t *val)
> @@ -575,9 +575,9 @@ static void die_bad_number(const char *name, const char *value)
>  		value = "";
>  
>  	if (cf && cf->name)
> -		die("bad numeric config value '%s' for '%s' in %s: %s",
> +		die(_("bad numeric config value '%s' for '%s' in %s: %s"),
>  		    value, name, cf->name, reason);
> -	die("bad numeric config value '%s' for '%s': %s", value, name, reason);
> +	die(_("bad numeric config value '%s' for '%s': %s"), value, name, reason);
>  }
>  
>  int git_config_int(const char *name, const char *value)
> @@ -662,7 +662,7 @@ int git_config_pathname(const char **dest, const char *var, const char *value)
>  		return config_error_nonbool(var);
>  	*dest = expand_user_path(value);
>  	if (!*dest)
> -		die("Failed to expand user dir in: '%s'", value);
> +		die(_("Failed to expand user dir in: '%s'"), value);

nit : error messages start with a small letter. same case below for "Invalid". ;)

>  	return 0;
>  }
>  
> @@ -740,7 +740,7 @@ static int git_default_core_config(const char *var, const char *value)
>  		if (level == -1)
>  			level = Z_DEFAULT_COMPRESSION;
>  		else if (level < 0 || level > Z_BEST_COMPRESSION)
> -			die("bad zlib compression level %d", level);
> +			die(_("bad zlib compression level %d"), level);
>  		zlib_compression_level = level;
>  		zlib_compression_seen = 1;
>  		return 0;
> @@ -751,7 +751,7 @@ static int git_default_core_config(const char *var, const char *value)
>  		if (level == -1)
>  			level = Z_DEFAULT_COMPRESSION;
>  		else if (level < 0 || level > Z_BEST_COMPRESSION)
> -			die("bad zlib compression level %d", level);
> +			die(_("bad zlib compression level %d"), level);
>  		core_compression_level = level;
>  		core_compression_seen = 1;
>  		if (!zlib_compression_seen)
> @@ -873,7 +873,7 @@ static int git_default_core_config(const char *var, const char *value)
>  		else if (!strcmp(value, "link"))
>  			object_creation_mode = OBJECT_CREATION_USES_HARDLINKS;
>  		else
> -			die("Invalid mode for object creation: %s", value);
> +			die(_("Invalid mode for object creation: %s"), value);
>  		return 0;
>  	}
>  
> @@ -1173,7 +1173,7 @@ int git_config_early(config_fn_t fn, void *data, const char *repo_config)
>  
>  	switch (git_config_from_parameters(fn, data)) {
>  	case -1: /* error */
> -		die("unable to parse command-line config");
> +		die(_("unable to parse command-line config"));
>  		break;
>  	case 0: /* found nothing */
>  		break;
> @@ -1514,7 +1514,7 @@ static int store_aux(const char *key, const char *value, void *cb)
>  	case KEY_SEEN:
>  		if (matches(key, value)) {
>  			if (store.seen == 1 && store.multi_replace == 0) {
> -				warning("%s has multiple values", key);
> +				warning(_("%s has multiple values"), key);
>  			}
>  
>  			ALLOC_GROW(store.offset, store.seen + 1,
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] config.c: mark error and warnings strings for translation
  2014-07-31 12:11 ` Tanay Abhra
@ 2014-07-31 12:18   ` Matthieu Moy
  0 siblings, 0 replies; 3+ messages in thread
From: Matthieu Moy @ 2014-07-31 12:18 UTC (permalink / raw)
  To: Tanay Abhra; +Cc: git, gitster

Tanay Abhra <tanayabh@gmail.com> writes:

> On 7/31/2014 5:01 PM, Matthieu Moy wrote:
>> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
>> ---
>> Noticed while reviewing Tanay's patches, but this one is independant
>> from his series, both syntactically and semantically.
>> 
>>  config.c | 20 ++++++++++----------
>>  1 file changed, 10 insertions(+), 10 deletions(-)
>> 
>> diff --git a/config.c b/config.c
>> index a191328..76eeb63 100644
>> --- a/config.c
>> +++ b/config.c
>> @@ -457,9 +457,9 @@ static int git_parse_source(config_fn_t fn, void *data)
>>  			break;
>>  	}
>>  	if (cf->die_on_error)
>> -		die("bad config file line %d in %s", cf->linenr, cf->name);
>> +		die(_("bad config file line %d in %s"), cf->linenr, cf->name);
>>  	else
>> -		return error("bad config file line %d in %s", cf->linenr, cf->name);
>> +		return error(_("bad config file line %d in %s"), cf->linenr, cf->name);
>
> Can I package your patch with mine in which I am going to change the
> error message to print the variable name also?

Yes, you can include it as PATCH 1 for example, and then build on top.

>> @@ -662,7 +662,7 @@ int git_config_pathname(const char **dest, const char *var, const char *value)
>>  		return config_error_nonbool(var);
>>  	*dest = expand_user_path(value);
>>  	if (!*dest)
>> -		die("Failed to expand user dir in: '%s'", value);
>> +		die(_("Failed to expand user dir in: '%s'"), value);
>
> nit : error messages start with a small letter. same case below for "Invalid". ;)

Indeed. Then I'm letting you continue on the patch.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-07-31 12:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-31 11:31 [PATCH] config.c: mark error and warnings strings for translation Matthieu Moy
2014-07-31 12:11 ` Tanay Abhra
2014-07-31 12:18   ` Matthieu Moy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.