Closed Bug 632547 Opened 13 years ago Closed 13 years ago

[traceback] SyntaxError: invalid syntax

Categories

(support.mozilla.org :: Localization, task)

task
Not set
major

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: stephend, Assigned: smolejv)

References

()

Details

Attachments

(1 file)

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
Hi Vito; mind taking a look at this?  Thanks!
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
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"
Assignee: nobody → smolejv
Vito, Kadir, can we please get this fixed today before our release?
Status: ASSIGNED → RESOLVED
Closed: 13 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
Closed: 13 years ago13 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
Closed: 13 years ago13 years ago
Resolution: --- → FIXED
r82649 broke messages.po. Fixed in r82651.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: