Closed Bug 570057 Opened 14 years ago Closed 14 years ago

/en-GB/jsi18n crashes

Categories

(addons.mozilla.org Graveyard :: Localization, defect, P1)

defect

Tracking

(Not tracked)

VERIFIED FIXED
5.11.1

People

(Reporter: jbalogh, Assigned: stas)

References

()

Details

(Keywords: l12y, Whiteboard: [z][firefoxcup])

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
Keywords: l12y
Whiteboard: [z] → [z][firefoxcup]
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
Closed: 14 years ago
Resolution: --- → FIXED
If these work now and there's fxcup localizations, we should add these back to our available languages.
(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 → ---
Priority: -- → P1
http://github.com/jbalogh/zamboni/commit/f2676452cecfd8ab8bc6fd15e607a83df74479e2
Status: REOPENED → RESOLVED
Closed: 14 years ago14 years ago
Resolution: --- → FIXED
Thanks, Wil.
Product: addons.mozilla.org → addons.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.