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...