Error pulling translation with 'paver i18n_robot_pull': 'plural forms expression could be dangerous'

Description

Currently, it seems the "paver i18n_robot_pull" command is not working properly, and causing an error when updating the language in JS assets. We have been able to reproduce this issue with Hawthorn.1 and Hawthorn.2 releases for Open edX.

Note that this was originally reported on a Bitnami installation, but we were able to reproduce it edX's native stack indicating it is common to both.
We also searched for similar issues but we did not find any, please merge or close if you are already aware of this.

Find the full error trace below:

```
INFO:i18n.generate:Copying mapped locale /edx/app/edxapp/edx-platform/conf/locale/zh_CN/LC_MESSAGES to /edx/app/edxapp/edx-platform/conf/locale/zh_HANS/LC_MESSAGES
python manage.py lms --settings=aws compilejsi18n
Traceback (most recent call last):
File "manage.py", line 118, in <module>
startup.run()
File "/edx/app/edxapp/edx-platform/lms/startup.py", line 19, in run
django.setup()
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/_init_.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/apps/registry.py", line 108, in populate
app_config.import_models()
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/apps/config.py", line 202, in import_models
self.models_module = import_module(models_module_name)
File "/usr/lib/python2.7/importlib/_init_.py", line 37, in import_module
_import_(name)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/contrib/auth/models.py", line 103, in <module>
class Group(models.Model):
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/db/models/base.py", line 162, in _new_
new_class.add_to_class(obj_name, obj)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/db/models/base.py", line 325, in add_to_class
value.contribute_to_class(cls, name)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/db/models/fields/related.py", line 1648, in contribute_to_class
self.remote_field.through = create_many_to_many_intermediary_model(self, cls)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/db/models/fields/related.py", line 1104, in create_many_to_many_intermediary_model
'verbose_name': ('%(from)s-%(to)s relationship') % {'from': from, 'to': to},
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/utils/functional.py", line 162, in _mod_
return six.text_type(self) % rhs
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/utils/functional.py", line 119, in __text_cast
return func(*self._args, **self._kw)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/utils/translation/_init_.py", line 89, in ugettext
return _trans.ugettext(message)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 345, in ugettext
return do_translate(message, 'ugettext')
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 321, in do_translate
_default = _default or translation(settings.LANGUAGE_CODE)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 228, in translation
_translations[language] = DjangoTranslation(language)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 131, in _init_
self._add_local_translations()
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 183, in _add_local_translations
translation = self._new_gnu_trans(localedir)
File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 156, in _new_gnu_trans
fallback=use_null_fallback)
File "/usr/lib/python2.7/gettext.py", line 496, in translation
t = translations.setdefault(key, class(fp))
File "/usr/lib/python2.7/gettext.py", line 182, in _init_
self._parse(fp)
File "/usr/lib/python2.7/gettext.py", line 318, in _parse
self.plural = c2py(plural)
File "/usr/lib/python2.7/gettext.py", line 95, in c2py
raise ValueError, 'plural forms expression could be dangerous'
ValueError: plural forms expression could be dangerous

Captured Task Output:
---------------------

---> pavelib.i18n.i18n_robot_pull
---> pavelib.i18n.i18n_clean
git clean -fdX conf/locale
---> pavelib.i18n.i18n_transifex_pull
---> pavelib.i18n.i18n_validate_transifex_config
i18n_tool transifex pull
---> pavelib.i18n.i18n_extract
---> pavelib.prereqs.install_prereqs
---> pavelib.i18n.i18n_validate_gettext
i18n_tool extract
---> pavelib.i18n.i18n_dummy
i18n_tool dummy
i18n_tool generate
python manage.py lms --settings=aws compilejsi18n
```

Also, please find attached the full output, including the error trace above, for the 'paver i18n_robot_pull' command.

Steps to Reproduce

Launch an instance with Native stack using the "open-release/hawthorn.2" release: https://openedx.atlassian.net/wiki/spaces/OpenOPS/pages/146440579/Native%2BOpen%2BedX%2BUbuntu%2B16.04%2B64%2Bbit%2BInstallation
Then, follow the steps below to pull translations (https://github.com/edx/edx-platform/wiki/Internationalization-and-localization):

  • Switch to the edxapp user: sudo -H -u edxapp bash

  • Create the '~/.transifexrc' file with the credentials for your Transifex account.

  • Load edxapp environment: source /edx/app/edxapp/edxapp_env

  • Navigate to edx-platform: cd /edx/app/edxapp/edx-platform

  • Install development requirements with Pip: pip install -r requirements/edx/development.txt

  • Pull translations: paver i18n_robot_pull

  • The previous command fails with the error mentioned in the issue.

Status

Assignee

Marco Morales

Reporter

Marcos Bjoerkelund

Labels

None

Priority

Unset