Question

I have a Django application that has translations for 24 languages. Everything is working fine, except the polish translations are not working!

When I try to activate the polish language django.utils.translation.activate(lang_code) I always get this error:

   ValueError at /pl/traininglog/
   plural forms expression could be dangerous

The plural form expression that Django generates is this (also notice the line break):

"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 "
"|| n%100>=20) ? 1 : 2)\n"

I checked with the gettext website and other sites and this should be the right expression.

The strange thing: When I change the Plural-Forms string to something obviously wrong or even delete it, the error message stays the same. (And yes, I do a: ./manage.py compilemessages)

As said, the other 23 languages work like expected. Anyone had the same or similar issue?

Thanks in advance, Anton

Was it helpful?

Solution

I found the error.

I have an older Version of Django-Fiber installed. Which uses (and also older Version) of django-mptt to store stuff in the database. And this older (0.5.1) Version of mptt has a bug with their polish translations, that was fixed in this commit:

https://github.com/django-mptt/django-mptt/commit/4b6a9758396450651bc2d02b2c7d49bac6cd3f25

I updated mptt to version 0.5.5 and everything works fine now!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top