From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: "Jean-Noël Avila via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, "Bagas Sanjaya" <bagasdotme@gmail.com>,
"Johannes Sixt" <j6t@kdbg.org>,
"Jean-Noël Avila" <jn.avila@free.fr>
Subject: Re: [PATCH v2 1/6] i18n: factorize generic failure messages
Date: Sun, 03 Apr 2022 16:47:16 +0200 [thread overview]
Message-ID: <220403.86k0c6kyi5.gmgdl@evledraar.gmail.com> (raw)
In-Reply-To: <4bba3e1f6cb9cdc35b0dc8da440e38de256b4d2b.1648915853.git.gitgitgadget@gmail.com>
On Sat, Apr 02 2022, Jean-Noël Avila via GitGitGadget wrote:
> From: =?UTF-8?q?Jean-No=C3=ABl=20Avila?= <jn.avila@free.fr>
> [...]
> diff --git a/add-patch.c b/add-patch.c
> index 55d719f7845..8c9e81ec78e 100644
> --- a/add-patch.c
> +++ b/add-patch.c
> @@ -1181,7 +1181,7 @@ static int run_apply_check(struct add_p_state *s,
> "apply", "--check", NULL);
> strvec_pushv(&cp.args, s->mode->apply_check_args);
> if (pipe_command(&cp, s->buf.buf, s->buf.len, NULL, 0, NULL, 0))
> - return error(_("'git apply --cached' failed"));
> + return error(_("the command '%s' failed"), "git apply --cached");
>
> return 0;
> }
> @@ -1683,7 +1683,7 @@ soft_increment:
> strvec_pushv(&cp.args, s->mode->apply_args);
> if (pipe_command(&cp, s->buf.buf, s->buf.len,
> NULL, 0, NULL, 0))
> - error(_("'git apply' failed"));
> + error(_("the command '%s' failed"), "git apply");
> }
> if (repo_read_index(s->s.r) >= 0)
> repo_refresh_and_write_index(s->s.r, REFRESH_QUIET, 0,
> diff --git a/builtin/am.c b/builtin/am.c
> index 0f4111bafa0..a0a57049510 100644
> --- a/builtin/am.c
> +++ b/builtin/am.c
> @@ -586,7 +586,7 @@ static int is_mail(FILE *fp)
> int ret = 1;
>
> if (fseek(fp, 0L, SEEK_SET))
> - die_errno(_("fseek failed"));
> + die_errno(_("the function '%s' failed"), "fseek");
>
> if (regcomp(®ex, header_regex, REG_NOSUB | REG_EXTENDED))
> die("invalid pattern: %s", header_regex);
I don't think this needs to happen now, but I wonder if it would be
worth it as a follow-up to e.g. create a gettext-common.h or something,
with macros like:
#define I18N_COMMAND_FAILED N_("the command '%s' failed")
#define I18N_FUNCTION_FAILED_ERRNO N_("the library function '%s' failed")
Then:
error(_(I18N_FUNCTION_FAILED_ERRNO), "git apply");
die_errno(_(I18N_FUNCTION_FAILED_ERRNO), "fseek");
But OTOH all the gettext tooling already takes care of that, so maybe
it's not worth it. I.e. "jump to definition" would jump to the wrapper
header, as opposed to the actual code involved.
So having written that, probably not. Maybe the only worthwhile thing
would be some Levenshtein distance check in CI or something to see if
we're adding strings that are too similar to existing ones...
next prev parent reply other threads:[~2022-04-03 14:55 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-20 21:54 [PATCH 0/7] More i18n fixes Jean-Noël Avila via GitGitGadget
2022-03-20 21:54 ` [PATCH 1/7] i18n: factorize generic failure messages Jean-Noël Avila via GitGitGadget
2022-03-20 21:54 ` [PATCH 2/7] sequencer: factor GIT_AUTHOR_* from message strings Bagas Sanjaya via GitGitGadget
2022-03-21 5:22 ` Bagas Sanjaya
2022-03-20 21:54 ` [PATCH 3/7] i18n: factorize "bad argument" messages Jean-Noël Avila via GitGitGadget
2022-03-20 21:54 ` [PATCH 4/7] i18n: factorize "Server does not support foo" messages Jean-Noël Avila via GitGitGadget
2022-03-20 21:54 ` [PATCH 5/7] i18n: factorize "foo does not take arguments" messages Jean-Noël Avila via GitGitGadget
2022-03-20 21:54 ` [PATCH 6/7] i18n: factorize read-cache error messages Jean-Noël Avila via GitGitGadget
2022-03-20 21:54 ` [PATCH 7/7] i18n: factorize unrecognized options arguments messages Jean-Noël Avila via GitGitGadget
2022-03-21 6:48 ` [PATCH 0/7] More i18n fixes Johannes Sixt
2022-03-21 13:59 ` Ævar Arnfjörð Bjarmason
2022-03-21 19:03 ` Junio C Hamano
2022-03-21 20:13 ` Jean-Noël AVILA
2022-03-21 20:35 ` Jean-Noël AVILA
2022-04-02 16:10 ` [PATCH v2 0/6] " Jean-Noël Avila via GitGitGadget
2022-04-02 16:10 ` [PATCH v2 1/6] i18n: factorize generic failure messages Jean-Noël Avila via GitGitGadget
2022-04-03 5:56 ` Bagas Sanjaya
2022-04-03 14:34 ` Ævar Arnfjörð Bjarmason
2022-04-03 14:47 ` Ævar Arnfjörð Bjarmason [this message]
2022-04-02 16:10 ` [PATCH v2 2/6] sequencer: factor GIT_AUTHOR_* from message strings Bagas Sanjaya via GitGitGadget
2022-04-02 16:10 ` [PATCH v2 3/6] i18n: factorize server support messages in fetch-pack Jean-Noël Avila via GitGitGadget
2022-04-02 16:10 ` [PATCH v2 4/6] i18n: factorize "foo does not take arguments" messages Jean-Noël Avila via GitGitGadget
2022-04-03 14:39 ` Ævar Arnfjörð Bjarmason
2022-04-03 22:21 ` Junio C Hamano
2022-04-02 16:10 ` [PATCH v2 5/6] i18n: factorize read-cache error messages Jean-Noël Avila via GitGitGadget
2022-04-03 22:29 ` Junio C Hamano
2022-04-02 16:10 ` [PATCH v2 6/6] i18n: factorize "bad argument" messages Jean-Noël Avila via GitGitGadget
2022-04-03 14:41 ` Ævar Arnfjörð Bjarmason
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=220403.86k0c6kyi5.gmgdl@evledraar.gmail.com \
--to=avarab@gmail.com \
--cc=bagasdotme@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=j6t@kdbg.org \
--cc=jn.avila@free.fr \
/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).