From: Junio C Hamano <gitster@pobox.com>
To: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Cc: git@vger.kernel.org, Elijah Newren <newren@gmail.com>,
Derrick Stolee <stolee@gmail.com>
Subject: Re: [PATCH v2 01/23] Update messages in preparation for i18n
Date: Thu, 19 Jul 2018 11:18:55 -0700 [thread overview]
Message-ID: <xmqqr2jzf5rk.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <20180718161101.19765-2-pclouds@gmail.com> ("Nguyễn Thái Ngọc Duy"'s message of "Wed, 18 Jul 2018 18:10:39 +0200")
Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:
> static void check_argc(int argc, int min, int max) {
> if (argc >= min && argc <= max)
> return;
> - error("wrong number of arguments");
> + if (min == max)
> + error("wrong number of arguments, should be %d", min);
> + else
> + error("wrong number of arguments, should be from %d to %d",
> + min, max);
> usage_with_options(builtin_config_usage, builtin_config_options);
> }
Good. This was the only instance of
> - some messages are improved to give more information
I spotted.
> @@ -622,7 +626,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)
> * location; error out even if XDG_CONFIG_HOME
> * is set and points at a sane location.
> */
> - die("$HOME not set");
> + die("$HOME is not set");
Meh. There are many verb-less messages e.g. "only one X at a time"
that are not given a new verb in this patch.
> @@ -819,7 +823,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)
> if (ret < 0)
> return ret;
> if (ret == 0)
> - die("No such section!");
> + die("no such section: %s", argv[0]);
> }
> else if (actions == ACTION_REMOVE_SECTION) {
> int ret;
> @@ -830,7 +834,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)
> if (ret < 0)
> return ret;
> if (ret == 0)
> - die("No such section!");
> + die("no such section: %s", argv[0]);
> }
There are check_argc() calls before these two hunks to ensure that
access to argv[0] is safe, so these are good.
> @@ -2638,7 +2638,7 @@ static void read_object_list_from_stdin(void)
> if (feof(stdin))
> break;
> if (!ferror(stdin))
> - die("fgets returned NULL, not EOF, not error!");
> + die("BUG: fgets returned NULL, not EOF, not error!");
This is not BUG("...") because it is not *our* bug but a bug in platform's stdio?
> @@ -456,10 +456,10 @@ static int create_graft(int argc, const char **argv, int force, int gentle)
> return -1;
> }
>
> - if (remove_signature(&buf)) {
> - warning(_("the original commit '%s' has a gpg signature."), old_ref);
> - warning(_("the signature will be removed in the replacement commit!"));
> - }
> + if (remove_signature(&buf))
> + warning(_("the original commit '%s' has a gpg signature.\n"
> + "The signature will be removed in the replacement commit!"),
> + old_ref);
Unlike a compound sentence, for which translators may appreciate
that they can reorder the parts of it to suit their language, I do
not see why these two independent sentences should be placed in a
single warning().
Or is this primarily about avoiding repeated appearance of
"warning:" labels, i.e.
warning: sentence one
warning: sentence two
I am not sure if these belong to this "simple mechanical conversion
or otherwise uncontrovercial improvement" series.
> diff --git a/config.c b/config.c
> index f4a208a166..6ba07989f1 100644
> --- a/config.c
> +++ b/config.c
> @@ -461,7 +461,7 @@ int git_config_from_parameters(config_fn_t fn, void *data)
> envw = xstrdup(env);
>
> if (sq_dequote_to_argv(envw, &argv, &nr, &alloc) < 0) {
> - ret = error("bogus format in " CONFIG_DATA_ENVIRONMENT);
> + ret = error("bogus format in %s", CONFIG_DATA_ENVIRONMENT);
> goto out;
> }
>
Good job spotting that the original wanted to say, but failed to
say, that CONFIG_DATA_ENVIRONMENT as the source of broken data we
detected. But I am not sure CONFIG_DATA_ENVIRONMENT is what we want
to report as the source of bad data to the end users. One-shot
configuration we get form "git -c VAR=VAL" are placed in the
environment as an internal implementation detail, so from their
point of view, the place we saw broken data coming from is their
command line "git -c VAR=VAL" one-shot configuration.
> @@ -1409,11 +1409,11 @@ static int git_default_push_config(const char *var, const char *value)
> push_default = PUSH_DEFAULT_UPSTREAM;
> else if (!strcmp(value, "current"))
> push_default = PUSH_DEFAULT_CURRENT;
> - else {
> - error("malformed value for %s: %s", var, value);
> - return error("Must be one of nothing, matching, simple, "
> - "upstream or current.");
> - }
> + else
> + return error("malformed value for %s: %s\n"
> + "Must be one of nothing, matching, simple, "
> + "upstream or current.",
> + var, value);
The same comment as an earlier warning().
> - if (flags & CONNECT_VERBOSE)
> - fprintf(stderr, "done.\nConnecting to %s (port %s) ... ", host, port);
> + if (flags & CONNECT_VERBOSE) {
> + fprintf_ln(stderr, "done.");
> + fprintf(stderr, "Connecting to %s (port %s) ... ", host, port);
> + }
It was not immediately obvious why this is a good change, but with
this patch, we have many instances of "done." that can share the
same translation, I guess.
> diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh
> diff --git a/t/t3005-ls-files-relative.sh b/t/t3005-ls-files-relative.sh
> diff --git a/t/t5801-remote-helpers.sh b/t/t5801-remote-helpers.sh
> diff --git a/t/t7063-status-untracked-cache.sh b/t/t7063-status-untracked-cache.sh
It is surprising that the fallout from the conversions in the rest
of the patch is this small ;-)
Whew. This was a rather sizeable patch. The parts I did not quote
and comment all looked good.
Thanks.
next prev parent reply other threads:[~2018-07-19 18:19 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-18 16:10 [PATCH v2 00/23] Mark strings for translation Nguyễn Thái Ngọc Duy
2018-07-18 16:10 ` [PATCH v2 01/23] Update messages in preparation for i18n Nguyễn Thái Ngọc Duy
2018-07-19 18:18 ` Junio C Hamano [this message]
2018-07-19 18:29 ` Junio C Hamano
2018-07-21 7:37 ` Duy Nguyen
2018-07-18 16:10 ` [PATCH v2 02/23] archive-tar.c: mark more strings for translation Nguyễn Thái Ngọc Duy
2018-07-19 18:21 ` Junio C Hamano
2018-07-21 6:18 ` Duy Nguyen
2018-07-18 16:10 ` [PATCH v2 03/23] archive-zip.c: " Nguyễn Thái Ngọc Duy
2018-07-19 18:26 ` Junio C Hamano
2018-07-19 18:48 ` Duy Nguyen
2018-07-19 19:30 ` Junio C Hamano
2018-07-18 16:10 ` [PATCH v2 04/23] builtin/config.c: " Nguyễn Thái Ngọc Duy
2018-07-18 16:10 ` [PATCH v2 05/23] builtin/grep.c: mark " Nguyễn Thái Ngọc Duy
2018-07-18 16:10 ` [PATCH v2 06/23] builtin/pack-objects.c: mark more " Nguyễn Thái Ngọc Duy
2018-07-19 18:40 ` Junio C Hamano
2018-07-18 16:10 ` [PATCH v2 07/23] builtin/replace.c: " Nguyễn Thái Ngọc Duy
2018-07-18 16:10 ` [PATCH v2 08/23] commit-graph.c: " Nguyễn Thái Ngọc Duy
2018-07-18 16:10 ` [PATCH v2 09/23] config.c: " Nguyễn Thái Ngọc Duy
2018-07-18 16:10 ` [PATCH v2 10/23] connect.c: " Nguyễn Thái Ngọc Duy
2018-07-19 18:51 ` Junio C Hamano
2018-07-18 16:10 ` [PATCH v2 11/23] convert.c: " Nguyễn Thái Ngọc Duy
2018-07-18 16:10 ` [PATCH v2 12/23] dir.c: " Nguyễn Thái Ngọc Duy
2018-07-18 16:10 ` [PATCH v2 13/23] environment.c: " Nguyễn Thái Ngọc Duy
2018-07-18 16:10 ` [PATCH v2 14/23] exec-cmd.c: " Nguyễn Thái Ngọc Duy
2018-07-18 16:10 ` [PATCH v2 15/23] object.c: " Nguyễn Thái Ngọc Duy
2018-07-18 16:10 ` [PATCH v2 16/23] pkt-line.c: " Nguyễn Thái Ngọc Duy
2018-07-18 16:10 ` [PATCH v2 17/23] refs.c: " Nguyễn Thái Ngọc Duy
2018-07-18 16:10 ` [PATCH v2 18/23] refspec.c: " Nguyễn Thái Ngọc Duy
2018-07-18 16:10 ` [PATCH v2 19/23] replace-object.c: " Nguyễn Thái Ngọc Duy
2018-07-18 16:10 ` [PATCH v2 20/23] sequencer.c: " Nguyễn Thái Ngọc Duy
2018-07-18 16:10 ` [PATCH v2 21/23] sha1-file.c: " Nguyễn Thái Ngọc Duy
2018-07-18 16:11 ` [PATCH v2 22/23] transport.c: " Nguyễn Thái Ngọc Duy
2018-07-18 16:11 ` [PATCH v2 23/23] transport-helper.c: " Nguyễn Thái Ngọc Duy
2018-07-21 7:49 ` [PATCH v3 00/23] Mark " Nguyễn Thái Ngọc Duy
2018-07-21 7:49 ` [PATCH v3 01/23] Update messages in preparation for i18n Nguyễn Thái Ngọc Duy
2018-07-21 7:49 ` [PATCH v3 02/23] archive-tar.c: mark more strings for translation Nguyễn Thái Ngọc Duy
2018-07-21 7:49 ` [PATCH v3 03/23] archive-zip.c: " Nguyễn Thái Ngọc Duy
2018-07-21 7:49 ` [PATCH v3 04/23] builtin/config.c: " Nguyễn Thái Ngọc Duy
2018-07-21 7:49 ` [PATCH v3 05/23] builtin/grep.c: mark " Nguyễn Thái Ngọc Duy
2018-07-21 7:49 ` [PATCH v3 06/23] builtin/pack-objects.c: mark more " Nguyễn Thái Ngọc Duy
2018-07-21 7:49 ` [PATCH v3 07/23] builtin/replace.c: " Nguyễn Thái Ngọc Duy
2018-07-21 7:49 ` [PATCH v3 08/23] commit-graph.c: " Nguyễn Thái Ngọc Duy
2018-07-21 7:49 ` [PATCH v3 09/23] config.c: " Nguyễn Thái Ngọc Duy
2018-07-21 7:49 ` [PATCH v3 10/23] connect.c: " Nguyễn Thái Ngọc Duy
2018-07-21 7:49 ` [PATCH v3 11/23] convert.c: " Nguyễn Thái Ngọc Duy
2018-07-21 7:49 ` [PATCH v3 12/23] dir.c: " Nguyễn Thái Ngọc Duy
2018-07-21 7:49 ` [PATCH v3 13/23] environment.c: " Nguyễn Thái Ngọc Duy
2018-07-21 7:49 ` [PATCH v3 14/23] exec-cmd.c: " Nguyễn Thái Ngọc Duy
2018-07-21 7:49 ` [PATCH v3 15/23] object.c: " Nguyễn Thái Ngọc Duy
2018-07-21 7:49 ` [PATCH v3 16/23] pkt-line.c: " Nguyễn Thái Ngọc Duy
2018-07-21 7:49 ` [PATCH v3 17/23] refs.c: " Nguyễn Thái Ngọc Duy
2018-07-21 7:49 ` [PATCH v3 18/23] refspec.c: " Nguyễn Thái Ngọc Duy
2018-07-21 7:49 ` [PATCH v3 19/23] replace-object.c: " Nguyễn Thái Ngọc Duy
2018-07-21 7:49 ` [PATCH v3 20/23] sequencer.c: " Nguyễn Thái Ngọc Duy
2018-07-21 7:49 ` [PATCH v3 21/23] sha1-file.c: " Nguyễn Thái Ngọc Duy
2018-07-21 7:49 ` [PATCH v3 22/23] transport.c: " Nguyễn Thái Ngọc Duy
2018-07-21 7:49 ` [PATCH v3 23/23] transport-helper.c: " Nguyễn Thái Ngọc Duy
-- strict thread matches above, loose matches on Subject: below --
2018-06-02 4:32 [PATCH 00/22] Mark " Nguyễn Thái Ngọc Duy
2018-06-03 16:33 ` [PATCH v2 00/23] Mark " Nguyễn Thái Ngọc Duy
2018-06-03 16:33 ` [PATCH v2 01/23] Update messages in preparation for i18n Nguyễn Thái Ngọc Duy
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqr2jzf5rk.fsf@gitster-ct.c.googlers.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=newren@gmail.com \
--cc=pclouds@gmail.com \
--cc=stolee@gmail.com \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).