Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"django-admin.py makemessages -l en" adds Plural-Forms to the output file

Every time I run django-admin.py makemessages -l en, it adds the following line to the djangojs.po file:

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

After that, running python manage.py runserver breaks with this error:

ValueError: plural forms expression could be dangerous

Of course, removing that line will fix the error.
How can I prevent this line from being added?

P.S. I'm looking for a way to force django-admin not adding this line, or adding something I prefer, or at least something that doesn't produce an error.

I'm using Django 1.11.

like image 521
mahyard Avatar asked Jun 30 '18 12:06

mahyard


1 Answers

This is an issue that was due to missing plural forms in en translation catalogs. As a result django was inserting "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" as a default (which isn't valid syntax).

It was fixed when django 2.0 was released. See this issue for details.

For anyone having problems with this, it may be worth checking your version of django, and updating if necessary.

like image 62
tim-mccurrach Avatar answered Sep 30 '22 16:09

tim-mccurrach