[Development] format-like tr()

Giuseppe D'Angelo giuseppe.dangelo at kdab.com
Fri Oct 25 10:27:10 CEST 2024


Il 24/10/24 19:04, Edward Welbourne ha scritto:
> Given that that does also substitute the relevant number into the
> string, I offer:
> 
>    tr("The apple(s) you bought cost %L1", n).arg(price);
> 
> where the number controlling the singular/plural choice isn't inserted
> into the result, but something else is.

Yes, that's a better example than mine.

In principle it could still be handled -- just don't provide a 
replacement for it (who says that `n` has to be the first argument?):

> trFormat("The apple(s) you bought cost {}", price, Cardinality(n))

but I'm not sure if I like it. Anyway this is now officially "throwing 
ideas at the wall and see what sticks".


-- 
Giuseppe D'Angelo | giuseppe.dangelo at kdab.com | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - Trusted Software Excellence

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4244 bytes
Desc: Firma crittografica S/MIME
URL: <http://lists.qt-project.org/pipermail/development/attachments/20241025/ada8ad37/attachment-0001.bin>


More information about the Development mailing list