Search code examples
flaskinternationalizationjinja2gettext

No string translation of plural token using ngettext


I am trying to translate this ngettext. However I am still getting the english version. I can get it work using gettext. Any idea?

{{ngettext('%(num)s Movie found while searching.', '%(num)s Movies found while searching.', qty_movies)}}

messages.po

msgid "%(num)s Movie found while searching."
msgstr "%(num)s Filme encontrado na procura."

msgid "%(num)s Movies found while searching."
msgstr "%(num)s Filmes encontrados na procura."

Solution

  • After some research here, this is what I need

    msgid "%(num)s Movie found while searching."
    msgid_plural "%(num)s Movies found while searching."
    msgstr[0] "%(num)s Filme encontrado na procura."
    msgstr[1] "%(num)s Filmes encontrados na procura."