[Development] Alternative plural forms for English (and similar)
Nicolas Fella
nicolas.fella at gmx.de
Thu Apr 30 20:33:46 CEST 2026
Hi,
it should be pretty well-known that plurals are a complex topic when it
comes to translating. While languages like English and German generally
only distinguish between Singular and Plural, other languages can have
more complex rules. Qt supports all of that, so far so good.
However, even with English or German there are more subtleties involved.
When having zero items of something the plural form is used: "0 unread
messages" is a perfectly grammatical sentence. It often reads nicer to
instead have "No unread messages" instead though. It's possible to
achieve that with Qt by an additional if check and using a different
string, but this doesn't scale with the number of strings to be
translated and might clash with languages with more complex rules.
Instead it would be nice if Qt's translation system supported this
natively. From the translator's point of view this effectively becomes
an additional plural form (n==0). I've had a look at how hard it would
be to extend Qt to support that. It appears that the QtCore side is
flexible enough to handle this and reads the rules from the qm file, so
it's "just" a matter of teaching lupdate/lrelease about the alternative
plural rules. I've successfully hacked those to change the rules for
English-ish languages to achieve this, but it would probably need to be
opt-in in order to not break existing users that don't want this.
Before I spend more time on this, is this something that Qt would be
willing to support/accept? Are there any other considerations that I
should be aware of?
Cheers
Nico
More information about the Development
mailing list