Django: gettext raises ValueError: 'plural for

2019-02-14 19:41发布

问题:

If a auto generated django.po file contains the following line in its header

"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"

"manage.py runserver" raises

gettext.py", line 93, in c2py
raise ValueError, 'plural forms expression could be dangerous'
ValueError: plural forms expression could be dangerous

If i remove the line everything works. What does the header mean? Why is it somtimes generated (for example localisation of the haystack app)? What das the error message mean?

回答1:

It means that your translator forgot to fill it in properly.