[Solved]-Django – multiple pluralization in admin model

2👍

After getting deep into Django sources, this is not possible to do it in admin usecases without overriding many of functions.

👤tomis

5👍

You need to put in your .po file:

"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"

Then, in your template you use the plural form passing a valid counter. Gettext have all information needed:

  • It knows how many plurals there are
  • It knows how to calc the plural for a number
  • Django passes the msg_id for plural and a counter

Leave a comment