ngettext use for recursive plurals

Göran Uddeborg goeran at
Thu Aug 28 17:04:10 UTC 2008

Milo? Komar?evi? writes:
> Kudos to developers for using ngettext, but there is a slightly
> complicated example in anaconda:
> msgid_plural "%d of %d optional packages selected"
> For Serbian (and other Slavic languages I presume), the resulting
> localized version will depend on both numbers, not just the first.

Judging from the originals,

    msgid "%d of %d optional package selected"
    msgid_plural "%d of %d optional packages selected"

I would assume it is the second, not the first number which influences
the choice.

There is a problem here, and it is not restricted to Slavic languages.
It is a problem for Swedish (a Germanic language) too.  "Selected"
should be translated in different ways depending on the first number.

> I would like to file a BZ request for this to be broken up in two
> parts and used recursively, as in:
> msgid_plural "%d optional packages"
> #. TRANSLATORS: %s is substituted by the string above
> msgid_plural "%d of %s selected"
> Before I do so, just wanted to check this fits ok with other
> languages? Can't see a problem so far...

It's dangerous to compose sentences like that.  More often than not,
it breaks for some languages.  I don't personally know a language it
would break in, and it would solve the problem in Swedish too.  But
I'm still a bit afraid of it.

Unfortunately, the po format isn't made to cope with sentences with
more than one singular/plural distinction.  So I don't have any better
suggestion than yours.  I just wanted to warn about it.

More information about the trans mailing list