[Development] format-like tr()

Volker Hilsheimer volker.hilsheimer at qt.io
Thu Oct 24 09:43:40 CEST 2024


> On 23 Oct 2024, at 22:55, Thiago Macieira <thiago.macieira at intel.com> wrote:
>>> a) keep the "n" and make it mandatory, as in {n}
>> 
>> If we use std::format, then we cannot do it, because it does the
>> argument index parsing on its own, and delegates to a custom formatter
>> specialization after that. And argument index can only be a non-negative
>> integer value.
> 
> Ok, so if we use their parser, the number must be {0} or the only, right? How 
> do we communicate to translators and tooling that this a plural form? 

From my understanding, the idea behind the std::format framework would be to have a “cardinality" type for which we can implement a special formatter, allowing “whatever” to be in the format specification.

https://godbolt.org/z/j6avb6afr

Still supporting all the standard format specifications for integers is then an exercise I didn’t try.

> Should we bring this to SG16 and ask for their long-term idea (C++26 or 29)?


Always good to remind the committee that user interfaces are a thing ;)


Volker



More information about the Development mailing list