Plural forms in translations

For plural forms, you can use ngettext() and ngettext_lazy(). These functions translate singular and plural forms depending on an argument that indicates the number of objects. The following example shows how to use them:

output = ngettext('there is %(count)d product',                  'there are %(count)d products',                  count) % {'count': count}

Now that you know the basics about translating literals in our Python code, it's time to apply translations to our project.

Get Django 2 by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.