git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Alangi Derick <alangiderick@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Fixed a translation error
Date: Mon, 4 May 2015 14:18:39 -0700	[thread overview]
Message-ID: <20150504211839.GX5467@google.com> (raw)
In-Reply-To: <554766e9.b30db50a.72e3.ffff8bbe@mx.google.com>

Hi,

Alangi Derick wrote:

> [To: unlisted-recipients: no To-header on input <;]

Please don't do that.

What mailer do you use to send patches?  Others on the list using the
same mailer might be able to help with configuration tips.

> [Subject: [PATCH] Fixed a translation error]

The above commit description is vague and confusing: in fact, this
patch doesn't fix a translation error.  Instead, the commit
description should explain the purpose of the change in such a way as
to make it clear why a person might want to apply it.

More details are in Documentation/SubmittingPatches.

> Signed-off-by: Alangi Derick <alangiderick@gmail.com>

Thanks.

[...]
> +++ b/builtin/config.c

Yes, this is an okay command to start with.  Some messages are already
translated in this file, so it's a good example of a command that
currently presents an inconsistent interface in some languages.

[...]
> @@ -412,7 +412,7 @@ static int get_urlmatch(const char *var, const char *url)
>  	config.cb = &values;
>  
>  	if (!url_normalize(url, &config.url))
> -		die("%s", config.url.err);
> +		die(_("%s"), config.url.err);

This change is subtle.  It lets a translator replace the format "%s"
with something else --- that wouldn't be useful in any language, so
this string should not be marked for translation.

The underlying message in config.url.err is from urlmatch.c and is
already translated.

There are two more strings that need to be marked for translation in
this file: "Invalid key pattern: %s" and "Invalid pattern: %s".
Here's a preparatory patch to make that output more consistent.

One more piece of advice: when working on many similar patches like
this, a good strategy is to just send out one and get review for it.
When it has been reviewed and is in good shape, you can move on to
preparing and polishing the next patch.  The first few reviewed
patches can be used a template for the rest.

In other words, only once it's very clear that all the patches are
likely to be in good shape is it time to prepare and send out all of
them.  By working through only one patch at a time in a collection of
similar, unfinished patches, you avoid wasting time re-writing all the
patches in response to feedback and avoid overwhelming reviewers by
asking them to keep track of many reviews at once.  Most comments on
one patch will also apply to all the rest and the conversation only
has to happen once.

Thanks,
Jonathan

-- >8 --
Subject: config: use error() instead of fprintf(stderr, ...)

The die() / error() / warning() helpers put a fatal: / error: /
warning: prefix in front of the error message they print describing
the message's severity, which users are likely to be accustomed to
seeing these days.

This change will also be useful when marking the message for
translation: the argument to error() includes no newline at the end,
so it is less fussy for translators to translate without lines running
together in the translated output.

While we're here, start the error messages with a lowercase letter to
match the usual typography of error messages.

A quick web search and a code search at codesearch.debian.net finds no
scripts trying to parse these error messages, so this change should be
safe.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
 builtin/config.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/builtin/config.c b/builtin/config.c
index d32c532..89f3208 100644
--- a/builtin/config.c
+++ b/builtin/config.c
@@ -193,7 +193,7 @@ static int get_value(const char *key_, const char *regex_)
 
 		key_regexp = (regex_t*)xmalloc(sizeof(regex_t));
 		if (regcomp(key_regexp, key, REG_EXTENDED)) {
-			fprintf(stderr, "Invalid key pattern: %s\n", key_);
+			error("invalid key pattern: %s", key_);
 			free(key_regexp);
 			key_regexp = NULL;
 			ret = CONFIG_INVALID_PATTERN;
@@ -214,7 +214,7 @@ static int get_value(const char *key_, const char *regex_)
 
 		regexp = (regex_t*)xmalloc(sizeof(regex_t));
 		if (regcomp(regexp, regex_, REG_EXTENDED)) {
-			fprintf(stderr, "Invalid pattern: %s\n", regex_);
+			error("invalid pattern: %s", regex_);
 			free(regexp);
 			regexp = NULL;
 			ret = CONFIG_INVALID_PATTERN;
-- 

  reply	other threads:[~2015-05-04 21:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-04 11:16 [PATCH] Fixed a translation error Alangi Derick
2015-05-04 21:18 ` Jonathan Nieder [this message]
2015-05-04 21:29   ` Junio C Hamano
  -- strict thread matches above, loose matches on Subject: below --
2015-05-04 11:16 Alangi Derick

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150504211839.GX5467@google.com \
    --to=jrnieder@gmail.com \
    --cc=alangiderick@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).