Subject: Re: [PATCH 11/22] ident.c: mark strings for translation

From: Junio C Hamano <[email-masked]>
Date: Mon, 29 Feb 2016 10:34:59 -0800

Nguyễn Thái Ngọc Duy  <[email-masked]> writes:

> Signed-off-by: Nguyễn Thái Ngọc Duy <[email-masked]>
> ---

All (or at least most of) these look old ones; even the ones blamed
to 59f92959 (fmt_ident: refactor strictness checks, 2016-02-04) had
original in the same file without _().

I'm inclined to say we should do the whole thing post 2.8.0 release
for this file.

>  ident.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/ident.c b/ident.c
> index 6e12582..367a5dc 100644
> --- a/ident.c
> +++ b/ident.c
> @@ -75,13 +75,13 @@ static int add_mailname_host(struct strbuf *buf)
>  	mailname = fopen("/etc/mailname", "r");
>  	if (!mailname) {
>  		if (errno != ENOENT)
> -			warning("cannot open /etc/mailname: %s",
> +			warning(_("cannot open /etc/mailname: %s"),
>  				strerror(errno));
>  		return -1;
>  	}
>  	if (strbuf_getline(&mailnamebuf, mailname) == EOF) {
>  		if (ferror(mailname))
> -			warning("cannot read /etc/mailname: %s",
> +			warning(_("cannot read /etc/mailname: %s"),
>  				strerror(errno));
>  		strbuf_release(&mailnamebuf);
>  		fclose(mailname);
> @@ -125,7 +125,7 @@ static void add_domainname(struct strbuf *out, int *is_bogus)
>  	char buf[1024];
>  
>  	if (gethostname(buf, sizeof(buf))) {
> -		warning("cannot get host name: %s", strerror(errno));
> +		warning(_("cannot get host name: %s"), strerror(errno));
>  		strbuf_addstr(out, "(none)");
>  		*is_bogus = 1;
>  		return;
> @@ -355,18 +355,18 @@ const char *fmt_ident(const char *name, const char *email,
>  			using_default = 1;
>  			if (strict && default_name_is_bogus) {
>  				fputs(env_hint, stderr);
> -				die("unable to auto-detect name (got '%s')", name);
> +				die(_("unable to auto-detect name (got '%s')"), name);
>  			}
>  			if (strict && ident_use_config_only
>  			    && !(ident_config_given & IDENT_NAME_GIVEN))
> -				die("user.useConfigOnly set but no name given");
> +				die(_("user.useConfigOnly set but no name given"));
>  		}
>  		if (!*name) {
>  			struct passwd *pw;
>  			if (strict) {
>  				if (using_default)
>  					fputs(env_hint, stderr);
> -				die("empty ident name (for <%s>) not allowed", email);
> +				die(_("empty ident name (for <%s>) not allowed"), email);
>  			}
>  			pw = xgetpwuid_self(NULL);
>  			name = pw->pw_name;
> @@ -377,11 +377,11 @@ const char *fmt_ident(const char *name, const char *email,
>  		email = ident_default_email();
>  		if (strict && default_email_is_bogus) {
>  			fputs(env_hint, stderr);
> -			die("unable to auto-detect email address (got '%s')", email);
> +			die(_("unable to auto-detect email address (got '%s')"), email);
>  		}
>  		if (strict && ident_use_config_only
>  		    && !(ident_config_given & IDENT_MAIL_GIVEN))
> -			die("user.useConfigOnly set but no mail given");
> +			die(_("user.useConfigOnly set but no mail given"));
>  	}
>  
>  	strbuf_reset(&ident);
> @@ -396,7 +396,7 @@ const char *fmt_ident(const char *name, const char *email,
>  		strbuf_addch(&ident, ' ');
>  		if (date_str && date_str[0]) {
>  			if (parse_date(date_str, &ident) < 0)
> -				die("invalid date format: %s", date_str);
> +				die(_("invalid date format: %s"), date_str);
>  		}
>  		else
>  			strbuf_addstr(&ident, ident_default_date());