git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] builtin/diagnose.c: don't translate the two mode values

From
Alex Henrie <alexhenrie24@gmail.com>
Date
Sep 20, 2022, 17:54 UTC
Message-ID
<CAMMLpeRJ=4ES6d7pRP1Y232GyLx-jhN-ktfVernXrDiJuAC+tQ@mail.gmail.com>
In-Reply-To
<84848326-5cd9-b5b9-2dcb-a6d49879f47b@github.com>
On Tue, Sep 20, 2022 at 6:35 AM Derrick Stolee <derrickstolee@github.com> wrote:
>
> In diff.c, the descriptors exist in angle brackets, so the right thing
> would be N_("<mode>"). This seems non-standard compared to most other
> places.

I don't know which form is preferred in the code, but I did find that usage_argh adds the angle brackets if they are not already present:

static int usage_argh(const struct option *opts, FILE *outfile)
{
    const char *s;
    int literal = (opts->flags & PARSE_OPT_LITERAL_ARGHELP) ||
        !opts->argh || !!strpbrk(opts->argh, "()<>[]|");
    if (opts->flags & PARSE_OPT_OPTARG)
        if (opts->long_name)
            s = literal ? "[=%s]" : "[=<%s>]";
        else
            s = literal ? "[%s]" : "[<%s>]";
    else
        s = literal ? " %s" : " <%s>";
    return utf8_fprintf(outfile, s, opts->argh ? _(opts->argh) : _("..."));
}
Show 8 quoted lines
> Here is a similar stale translatable regex in diff.c:
>
>                 OPT_CALLBACK_F(0, "diff-filter", options, N_("[(A|C|D|M|R|T|U|X|B)...[*]]"),
>                                N_("select files by diff type"),
>
> So if you are looking into these kinds of replacements, it might be
> good to add instances like this. They are less important to the 2.38.0
> release, though.
Yeah, that one probably shouldn't be translatable either.
> This long-winded email is all just to say that I've looked into the
> standard way to handle this and agree that you are changing the code
> to match our best practices.
Thanks! I appreciate the feedback.
-Alex
Previous: Derrick Stolee
Message 3 of 3 in “builtin/diagnose.c: don't translate the two mode values”
  1. builtin/diagnose.c: don't translate the two mode valuesAlex Henrie, Sep 20, 2022
  2. Derrick StoleeSep 20, 2022
  3. Alex HenrieSep 20, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.