问题
I added 'Kurdish' language to my django website. this language is not supported by django, so I added to languages as follow: in settings.py
gettext = lambda s: s
NEW_LANG_INFO = {
'ku': {
'bidi': True,
'code': 'ku',
'name': 'Kurdish',
'name_local': u'کوردی',
},
}
import django.conf.locale
LANG_INFO = dict(**django.conf.locale.LANG_INFO, **NEW_LANG_INFO)
django.conf.locale.LANG_INFO = LANG_INFO
LANGUAGES = (
('en', 'English'),
('ku', gettext('Kurdish')),
('ar', 'Arabic')
)
now when i go to mysite.com/en/admin/
it works properly. when I go to mysite.com/ar/admin/
it works properly.
but when I go to mysite.com/ku/admin/
it raises an error with this message:
ValueError at /ku/admin/
invalid token in plural form: EXPRESSION
the django version is 1.11.6
.
what's the problem and how can i solve it?
Update
I find that in django.po in locale/ku/LC_MESSAGES
, the last line of comments is "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
回答1:
Here is also an answer to the same error, but a different case (their language is supported):
French translation raises "ValueError('invalid token in plural form: %s' % value)"
Maybe somebody finds that helpful. I was also searching for help and found your problem, but my solution was on the link above. (Solution was to delete the projects virtual environment and install it again)
来源:https://stackoverflow.com/questions/55429320/django-invalid-token-in-plural-form-expression