Django- invalid token in plural form: EXPRESSION

生来就可爱ヽ(ⅴ<●) 提交于 2020-02-25 04:47:45

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!