Django translating the plural model when the plural form is equal to the singular

How can you tell ugettext that the plural form is not the only form, even if they are equal in English?

class News(models.Model):
    class Meta:
        verbose_name = _('news')
        verbose_name_plural = _('news')

makemessages gives the following:

#: models.py:134, models.:135
msgid "news"
msgstr "noticia"

Separating this definition breaks the compilation into "defining a duplicate message ..."

Workarounds I found:

  • Add a space at the end of the plural form (the one I use)
  • Record application texts in Esperanto? Just kidding.
+5
source share
1 answer

Try:

from django.utils.translation import pgettext

class News(models.Model):
    class Meta:
        verbose_name = pgettext("news singular", "news")
        verbose_name_plural = pgettext("news plural", "news")
+3
source

All Articles