[traceback] SyntaxError: invalid syntax

VERIFIED FIXED in 2.5

Status

support.mozilla.org
Localization
--
major
VERIFIED FIXED
7 years ago
7 years ago

People

(Reporter: stephend, Assigned: Vito Smolej)

Tracking

unspecified

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(1 attachment)

(Reporter)

Description

7 years ago
https://master.support.mozilla.com/sl/jsi18n//build:fe2f998 throws a traceback:

Traceback (most recent call last):

  File "/data/www/support.allizom.org/kitsune/vendor/src/django/django/core/handlers/base.py", line 100, in get_response
    response = callback(request, *callback_args, **callback_kwargs)

  File "/data/www/support.allizom.org/kitsune/vendor/src/django/django/utils/decorators.py", line 76, in _wrapped_view
    response = view_func(request, *args, **kwargs)

  File "/data/www/support.allizom.org/kitsune/vendor/src/django/django/views/i18n.py", line 219, in javascript_catalog
    catalog = gettext_module.translation(domain, path, [locale])

  File "/usr/lib64/python2.6/gettext.py", line 480, in translation
    t = _translations.setdefault(key, class_(open(mofile, 'rb')))

  File "/usr/lib64/python2.6/gettext.py", line 180, in __init__
    self._parse(fp)

  File "/usr/lib64/python2.6/gettext.py", line 317, in _parse
    self.plural = c2py(plural)

  File "/usr/lib64/python2.6/gettext.py", line 126, in c2py
    return eval('lambda n: int(%s)' % plural)

  File "<string>", line 1

    lambda n: int((n%100==1. 0 : n%100==2. 1 : n%100==3  or  n%100==4. 2 : 3))

                             ^

SyntaxError: invalid syntax
(Reporter)

Comment 1

7 years ago
Hi Vito; mind taking a look at this?  Thanks!
(Assignee)

Comment 2

7 years ago
The question marks have miracously changed into periods; 

the statement should instead of
lambda n: int((n%100==1. 0 : n%100==2. 1 : n%100==3  or  n%100==4. 2 : 3))

read like
lambda n: int((n%100==1 ? 0 : n%100==2 ? 1 : n%100==3  or  n%100==4 ? 2 : 3))
 
I am attaching the correct messages.po file - there was already trouble once with this same sentence. I have evidently corrected it to the worse. Sorry for extra work!

I will also upload a changed file into Verbatim, so that it will come down the pipeline without this error.

Regards

Vito
Status: NEW → ASSIGNED
(Assignee)

Comment 3

7 years ago
Created attachment 511945 [details]
messages.po with a corrected "plural-Forms" sentence

here's the messages.po file, corrected for the "period-instead-of-?" error:
"Content-Transfer-Encoding: 8bit\n"
""Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n""
"X-Generator: Pootle 2.1.5\n"
(Reporter)

Updated

7 years ago
Assignee: nobody → smolejv
Vito, Kadir, can we please get this fixed today before our release?
Status: ASSIGNED → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → FIXED
Oops, did not mean to resolve.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Hey Vito, was there an issue with checking-in into Verbatim? I'll need to do that now on my end, since we are pushing the new version today. I hope that it doesn't break anything with your tools. But let me know please if it does, and we can talk about how to avoid that in the future.
Now we're getting "ValueError: plural forms expression error, maybe unbalanced parenthesis" errors again.
fixed, hopefully: r82649
Status: REOPENED → RESOLVED
Last Resolved: 7 years ago7 years ago
Resolution: --- → FIXED
Ah, perhaps we were unclear: This is coming from javascript.po, not messages.po.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
r82650
Status: REOPENED → RESOLVED
Last Resolved: 7 years ago7 years ago
Resolution: --- → FIXED
(Reporter)

Comment 11

7 years ago
Verified FIXED on https://support.allizom.org/sl/jsi18n/
Status: RESOLVED → VERIFIED
Target Milestone: --- → 2.5
r82649 broke messages.po. Fixed in r82651.
You need to log in before you can comment on or make changes to this bug.