[Answered ]-Django translation ngettext not working with gettext in the same file

1👍

You can’t alias ngettext as _. Only functions with single argument (gettext or gettext_lazy) can be aliased as _ as stated in documentation. The reason is how xgettext (GNU gettext tool) works.

0👍

the weird part about this situation is if you change the imports like this

from django.utils.translation import ngettext
from django.utils.translation import gettext as _

It will work as expected 🙂

Leave a comment