openedx / openedx/i18n-tools

invalid token in plural form: EXPRESSION

Open
#83 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
26
Forks
36
PR merge metrics
No merged PRs in 30d

Description

url http://127.0.0.1:8000/ms/

Environment:

Request Method: GET
Request URL: http://127.0.0.1:8000/ms/

Django Version: 2.2.8
Python Version: 3.6.9
Installed Applications:
['apps.admin_shortcuts',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.admin',
'django.contrib.sites',
'django.contrib.sitemaps',
'django.contrib.staticfiles',
'django.contrib.messages',
'django.contrib.humanize',
'rest_framework',
'ckeditor',
'cms',
'menus',
'sekizai',
'treebeard',
'djangocms_text_ckeditor',
'filer',
'easy_thumbnails',
'djangocms_file',
'djangocms_link',
'djangocms_picture',
'djangocms_style',
'djangocms_snippet',
'djangocms_googlemap',
'djangocms_video',
'fourgg',
'mptt',
'apps.cmsplugins_bootstrap4',
'apps.visitor',
'apps.member',
'apps.vendor',
'apps.accounting',
'apps.affiliate']
Installed Middleware:
['cms.middleware.utils.ApphookReloadMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.contrib.sites.middleware.CurrentSiteMiddleware',
'cms.middleware.user.CurrentUserMiddleware',
'cms.middleware.page.CurrentPageMiddleware',
'cms.middleware.toolbar.ToolbarMiddleware',
'cms.middleware.language.LanguageCookieMiddleware',
'apps.affiliate.middleware.RememberAgentMiddleware']

Traceback:

File "/home/program1/fourgg/venv/lib/python3.6/site-packages/django/core/handlers/exception.py" in inner
34. response = get_response(request)

File "/home/program1/fourgg/venv/lib/python3.6/site-packages/django/utils/deprecation.py" in call
93. response = self.process_request(request)

File "/home/program1/fourgg/venv/lib/python3.6/site-packages/django/middleware/locale.py" in process_request
25. translation.activate(language)

File "/home/program1/fourgg/venv/lib/python3.6/site-packages/django/utils/translation/init.py" in activate
170. return _trans.activate(language)

File "/home/program1/fourgg/venv/lib/python3.6/site-packages/django/utils/translation/trans_real.py" in activate
208. _active.value = translation(language)

File "/home/program1/fourgg/venv/lib/python3.6/site-packages/django/utils/translation/trans_real.py" in translation
197. _translations[language] = DjangoTranslation(language)

File "/home/program1/fourgg/venv/lib/python3.6/site-packages/django/utils/translation/trans_real.py" in init
96. self._add_installed_apps_translations()

File "/home/program1/fourgg/venv/lib/python3.6/site-packages/django/utils/translation/trans_real.py" in _add_installed_apps_translations
144. translation = self._new_gnu_trans(localedir)

File "/home/program1/fourgg/venv/lib/python3.6/site-packages/django/utils/translation/trans_real.py" in _new_gnu_trans
122. fallback=use_null_fallback,

File "/usr/lib/python3.6/gettext.py" in translation
538. t = translations.setdefault(key, class(fp))

File "/usr/lib/python3.6/gettext.py" in init
254. self._parse(fp)

File "/usr/lib/python3.6/gettext.py" in _parse
394. self.plural = c2py(plural)

File "/usr/lib/python3.6/gettext.py" in c2py
177. result, nexttok = _parse(_tokenize(plural))

File "/usr/lib/python3.6/gettext.py" in _parse
114. nexttok = next(tokens)

File "/usr/lib/python3.6/gettext.py" in _tokenize
91. raise ValueError('invalid token in plural form: %s' % value)

Exception Type: ValueError at /ms/
Exception Value: invalid token in plural form: EXPRESSION

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reported GET request and traceback, then inspect django/utils/translation/trans_real.py and the Python gettext.py plural-expression parser, especially c2py and _tokenize. Reproduce the invalid plural-form failure and identify the affected translation input; done means the issue has a confirmed cause and a regression check or clearly documented resolution.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
internationalization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.