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

Re: [RFC/PATCH] i18n of multi-line messages

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Dec 22, 2011, 21:44 UTC
Message-ID
<CACBZZX5Seh__OmAxGZUcSE6wwxyWa6HYTo_5m=y8SKnE4LoB=A@mail.gmail.com>
In-Reply-To
<7vaa6ldpk6.fsf@alter.siamese.dyndns.org>
On Thu, Dec 22, 2011 at 08:38, Junio C Hamano <gitster@pobox.com> wrote:
[Re-formatted for clarity]
Show 14 quoted lines
> -       vreportf("hint: ", advice, params);
> +       vreportf("hint", advice, params);
> -               vreportf("fatal: ", err, params);
> +               vreportf("fatal", err, params);
> -       vwritef(child_err, "fatal: ", err, params);
> +       vwritef(child_err, "fatal", err, params);
> -       vreportf("usage: ", err, params);
> +       vreportf("usage", err, params);
> -       vreportf("fatal: ", err, params);
> +       vreportf("fatal", err, params);
> -       vreportf("error: ", err, params);
> +       vreportf("error", err, params);
> -       vreportf("warning: ", warn, params);
> +       vreportf("warning", warn, params);
If we do it like this these would have to have something like:
    vreportf(N_("warning"), warn, params);
Followed by...:
Show 12 quoted lines
> +       strbuf_vaddf(&buf, fmt, params);
> +       for (cp = buf.buf; *cp; cp = np) {
> +               np = strchrnul(cp, '\n');
> +               /*
> +                * TRANSLATORS: the format is designed so that in RTL
> +                * languages you could reorder and put the "prefix" at
> +                * the end instead of the beginning of a line if you
> +                * wanted to.
> +                */
> +               strbuf_addf(&line,
> +                           _("%s: %.*s\n"),
> +                           prefix,
Changing this to _(prefix).
Show 8 quoted lines
> +                           (int)(np - cp), cp);
> +               emit(&line, cb_data);
> +               strbuf_reset(&line);
> +               if (*np)
> +                       np++;
> +       }
> +       strbuf_release(&buf);
> +       strbuf_release(&line);

But ideally to make things clear to the translators it's better to give them something like this to translate:

    error: %s
    message
Instead of just, as two separate things:
    error
    message
Because:
 1. We might use "error", "warning", "usage" etc. somewhere else, and
    unless we start using the msgctxt feature of gettext we can't
    distinguish between these.
 2. If you present them as two separate things the translator is
    likely to get the case wrong (e.g. translate "error" in the
    nominative case instead of say accusative).

But it's not a big deal, the patch looks good to me as-is with those N_() and _() changes. Just something to keep in mind.

We can always fixed issues like the one I'm raising later as they crop up.
Previous: Andreas Schwab
Message 15 of 15 in “i18n of multi-line messages”
  1. i18n of multi-line messagesJunio C Hamano, Dec 21, 2011
  2. Ævar Arnfjörð BjarmasonDec 22, 2011
  3. Junio C HamanoDec 22, 2011
  4. Thomas RastDec 22, 2011
  5. Johannes SixtDec 22, 2011
  6. Junio C HamanoDec 22, 2011
  7. Junio C HamanoDec 22, 2011
  8. Junio C HamanoDec 22, 2011
  9. Johannes SixtDec 22, 2011
  10. Junio C HamanoDec 22, 2011
  11. Johannes SixtDec 23, 2011
  12. Junio C HamanoDec 23, 2011
  13. Chris PackhamDec 22, 2011
  14. Andreas SchwabDec 22, 2011
  15. Ævar Arnfjörð BjarmasonDec 22, 2011

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.