Re: [PATCH v3 2/7] strbuf: split out logic to humanise byte values
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Dec 16, 2025, 01:19 UTC
- Message-ID
- <xmqqms3j5il1.fsf@gitster.g>
- In-Reply-To
- <20251215205639.2700270-3-jltobler@gmail.com>
Justin Tobler <jltobler@gmail.com> writes:
> + *value = xstrfmt(_("%u"), (unsigned)bytes);Does this "%u" need translation?
I very much doubt it, but if it did, this does need TRANSLATORS comment.
Show 15 quoted lines
> + *unit = humanise_rate ?
> + /* TRANSLATORS: IEC 80000-13:2008 byte/second */
> + Q_("byte/s", "bytes/s", bytes) :
> + /* TRANSLATORS: IEC 80000-13:2008 byte */
> + Q_("byte", "bytes", bytes);
> }
> }
>
> +static void strbuf_humanise(struct strbuf *buf, off_t bytes, unsigned flags)
> +{
> + char *value;
> + const char *unit;
> +
> + humanise_bytes(bytes, &value, &unit, flags);
> + strbuf_addf(buf, _("%s %s"), value, unit);This definitely needs the TRANSLATORS comment to tell what is going on.
> + free(value); > +}