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

Re: [PATCH v5] l10n: localizable upload progress messages

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 26, 2019, 17:58 UTC
Message-ID
<xmqq1rzgdy9g.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<CAPUT4mR7B1nS8x=S0UW6PQmw0XjjxvJ8nxsXz2n77fodBPaurw@mail.gmail.com>
Dimitriy <dimitriy.ryazantcev@gmail.com> writes:
Show 26 quoted lines
> Seems it can extract plural forms only from Q_ (ngettext() call) and
> cannot from _N (gettext_noop() call) in current configuration[0].
> Maybe in this case we can try to forward already translated string
> to strbuf_humanise():
>
> static void strbuf_humanise(struct strbuf *buf, off_t bytes, struct
> human_format *fmt)
> {
> ....
>         } else {
>                 strbuf_addf(buf, fmt->byte, (unsigned)bytes);
> ....
> }
>
> void strbuf_humanise_bytes(struct strbuf *buf, off_t bytes)
> {
>         struct human_format bytes_fmt = {
>                 .giga = _("%u.%2.2u GiB"),
>                 .mega = _("%u.%2.2u MiB"),
>                 .kilo = _("%u.%2.2u KiB"),
>                 .byte = Q_("%u byte", "%u bytes", (unsigned)bytes),
>         };
>         strbuf_humanise(buf, bytes, &bytes_fmt);
> }
>
> What do you think?

Well, I was trying to avoid making Q_() call when we did not have to, but if we are running with gettext, we cannot avoid calling Q_() every time this helper is called, as .byte field has to depend on the value of bytes, so...

Previous: Dimitriy
Message 4 of 4 in “l10n: localizable upload progress messages”
  1. l10n: localizable upload progress messagesDimitriy Ryazantcev, Jun 25, 2019
  2. Junio C HamanoJun 25, 2019
  3. DimitriyJun 26, 2019
  4. Junio C HamanoJun 26, 2019

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.