Subject: Re: [PATCH v2 2/7] strbuf: split out logic to humanise byte values

From: Junio C Hamano <[email-masked]>
Date: Tue, 16 Dec 2025 13:37:31 +0900

Jiang Xin <[email-masked]> writes:

> On Sat, Dec 13, 2025 at 6:37 AM Justin Tobler <[email-masked]> wrote:
>> +               return humanise_rate ?
>> +                              /* TRANSLATORS: IEC 80000-13:2008 byte/second */
>> +                              xstrfmt(Q_("byte/s", "bytes/s", bytes)) :
>> +                              /* TRANSLATORS: IEC 80000-13:2008 byte */
>> +                              xstrfmt(Q_("byte", "bytes", bytes));
>
> We have already defined "byte" as a 10n string without plural forms in the
> file "t/helper/test-simple-ipc.c" via commit 36a7eb6876 (t0052: add simple-ipc
> tests and t/helper/test-simple-ipc tool, 2021-03-22 10:29:48 +0000).
>
>     OPT_STRING(0, "byte", &bytevalue, N_("byte"), N_("ballast character")),
>
> The newly introduced usage of "byte" is now marked as having a plural form
> (via Q_("byte", "bytes", bytes)), which causes a conflict. This results in make
> pot failing with the following error:
>
>     msgcat: msgid 'byte' is used without plural and with plural.
>
> This happens because gettext requires that a given msgid be treated
> consistently—either exclusively as a singular string or as part of a plural
> construct—but not both.
>
> To resolve this conflict, we can unmark the singular "byte" in
> t/helper/test-simple-ipc.c, allowing it to reuse the translation from the
> plural-form definition of "byte".

I learned a new thing today and am happy :).

But how does one "unmark" the singular "byte" there, exactly?

Would something like this ...

     OPT_STRING(0, "byte", &bytevalue, Q_("byte", "bytes", 1), N_("ballast character")),

... a good idea, to "mark" it as a countable noun that has a plural
form?

Or did you mean that we can simply drop N_() around it, i.e.,
N_("byte") -> "byte", to discard the i18n, because it merely is a
test helper?

Punting is fine in this case, but in case a similar situation arises
in real code, it would be better to establish a pattern we can
follow.

Thanks.