/en-GB/jsi18n crashes

VERIFIED FIXED in 5.11.1

Status

addons.mozilla.org Graveyard
Localization
P1
normal
VERIFIED FIXED
8 years ago
2 years ago

People

(Reporter: jbalogh, Assigned: stas)

Tracking

({l12y})

Details

(Whiteboard: [z][firefoxcup], URL)

(Reporter)

Description

8 years ago
Django doesn't have an en-GB.  amo doesn't have one either at the moment, but we need to put it back for firefoxcup.

Traceback (most recent call last):

  File "/Users/jeff/dev/zamboni/vendor/src/django/django/core/servers/basehttp.py", line 280, in run
    self.result = application(self.environ, self.start_response)

  File "/Users/jeff/dev/zamboni/vendor/src/django/django/core/servers/basehttp.py", line 674, in __call__
    return self.application(environ, start_response)

  File "/Users/jeff/dev/zamboni/vendor/src/django/django/core/handlers/wsgi.py", line 241, in __call__
    response = self.get_response(request)

  File "/Users/jeff/dev/zamboni/vendor/src/django/django/core/handlers/base.py", line 143, in get_response
    return self.handle_uncaught_exception(request, resolver, exc_info)

  File "/Users/jeff/dev/zamboni/vendor/src/django/django/core/handlers/base.py", line 101, in get_response
    response = callback(request, *callback_args, **callback_kwargs)

  File "/Users/jeff/dev/zamboni/vendor/src/django/django/utils/decorators.py", line 68, in _wrapped_view
    response = view_func(request, *args, **kwargs)

  File "/Users/jeff/dev/zamboni/vendor/src/django/django/views/i18n.py", line 218, in javascript_catalog
    catalog = gettext_module.translation(domain, path, [locale])

  File "/usr/local/Cellar/python/2.6.4/lib/python2.6/gettext.py", line 478, in translation
    t = _translations.setdefault(key, class_(open(mofile, 'rb')))

  File "/usr/local/Cellar/python/2.6.4/lib/python2.6/gettext.py", line 180, in __init__
    self._parse(fp)

  File "/usr/local/Cellar/python/2.6.4/lib/python2.6/gettext.py", line 273, in _parse
    magic = unpack('<I', buf[:4])[0]

error: unpack requires a string argument of length 4
I don't think we can have en-GB because django doesn't have it, and I don't think it's worth investigating for the short time frame we have here.  -> stas for what he wants to do
Assignee: nobody → stas
(Assignee)

Updated

8 years ago
Keywords: l12y
Whiteboard: [z] → [z][firefoxcup]
(Assignee)

Comment 2

8 years ago
I think I figured this out.

Back when I added sl and en_GB to addons/trunk/site/app/locale (svn), I just bootstrapped the PO files with what Tower produced, ie. very simple files with empty msgstr's and no headers.

Trouble with this, as it turns out, is that such PO files compile to zero-byte MO files (since there's no translations in them, nor any meta information).

Unfortunately, this was breaking Python's gettext module which doesn't expect a MO file to have a length of 0. You can see in the traceback that it's checking the file endianness with `magic = unpack('<I', buf[:4])[0])`.

I added the PO headers to en-GB's and sl's z-javascript.po files in r68482.

They both work now in my local installation:
http://zamboni.dev.stasmade.com/en-GB/jsi18n/
http://zamboni.dev.stasmade.com/sl/jsi18n/

If you pull the new translation files, this bug will get fixed on the preview server :)
Status: NEW → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → FIXED
https://preview.addons.mozilla.org/en-GB/jsi18n and https://preview.addons.mozilla.org/z/en-GB/jsi18n are just 404s, now; good enough to verify?
(Reporter)

Comment 4

8 years ago
If these work now and there's fxcup localizations, we should add these back to our available languages.
(Assignee)

Comment 5

8 years ago
(In reply to comment #3)
> https://preview.addons.mozilla.org/en-GB/jsi18n and
> https://preview.addons.mozilla.org/z/en-GB/jsi18n are just 404s, now; good
> enough to verify?

No, this is how the crash looks like.

(In reply to comment #4)
> If these work now and there's fxcup localizations, we should add these back to
> our available languages.

Could you assign someone to it today, please? (reopening)
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
(Assignee)

Updated

8 years ago
Priority: -- → P1
http://github.com/jbalogh/zamboni/commit/f2676452cecfd8ab8bc6fd15e607a83df74479e2
Status: REOPENED → RESOLVED
Last Resolved: 8 years ago8 years ago
Resolution: --- → FIXED
(Assignee)

Comment 7

8 years ago
Thanks, Wil.
Verified FIXED on https://preview.addons.mozilla.org/z/en-GB/jsi18n/.
Status: RESOLVED → VERIFIED
Product: addons.mozilla.org → addons.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.