Index: tests/regressiontests/views/locale/en/LC_MESSAGES/djangojs.po
===================================================================
--- tests/regressiontests/views/locale/en/LC_MESSAGES/djangojs.po	(revisión: 11620)
+++ tests/regressiontests/views/locale/en/LC_MESSAGES/djangojs.po	(copia de trabajo)
@@ -1,20 +0,0 @@
-# SOME DESCRIPTIVE TITLE.
-# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
-# This file is distributed under the same license as the PACKAGE package.
-# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
-#
-#, fuzzy
-msgid ""
-msgstr ""
-"Project-Id-Version: PACKAGE VERSION\n"
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2007-09-15 16:45+0200\n"
-"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
-"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
-"Language-Team: LANGUAGE <LL@li.org>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-
-msgid "this is to be translated"
-msgstr "this is to be translated in english"
\ No newline at end of file
Index: tests/regressiontests/views/tests/i18n.py
===================================================================
--- tests/regressiontests/views/tests/i18n.py	(revisión: 11620)
+++ tests/regressiontests/views/tests/i18n.py	(copia de trabajo)
@@ -20,7 +20,7 @@
 
     def test_jsi18n(self):
         """The javascript_catalog can be deployed with language settings"""
-        for lang_code in ['es', 'fr', 'en']:
+        for lang_code in ['es', 'fr']:
             activate(lang_code)
             catalog = gettext.translation('djangojs', locale_dir, [lang_code])
             trans_txt = catalog.ugettext('this is to be translated')
@@ -28,3 +28,18 @@
             # in response content must to be a line like that:
             # catalog['this is to be translated'] = 'same_that_trans_txt'
             self.assertContains(response, trans_txt, 1)
+
+    def test_jsi18n_with_missing_en_locale(self):
+        """
+        The javascript_catalog shouldn't load the fallback language in the
+        case that the current selected language is actually the one translated
+        from, and hence missing translation files completely.
+
+        This happens easily when you're translating from English to other
+        languages and you've set settings.LANGUAGE_CODE to some other language
+        than English.
+        """
+        settings.LANGUAGE_CODE = 'es'
+        activate('en-us')
+        response = self.client.get('/views/jsi18n/')
+        self.assertNotContains(response, 'esto tiene que ser traducido')
Index: django/views/i18n.py
===================================================================
--- django/views/i18n.py	(revisión: 11620)
+++ django/views/i18n.py	(copia de trabajo)
@@ -127,6 +127,7 @@
     locale = to_locale(get_language())
     t = {}
     paths = []
+    en_catalog_missing = False
     # first load all english languages files for defaults
     for package in packages:
         p = importlib.import_module(package)
@@ -136,26 +137,29 @@
             catalog = gettext_module.translation(domain, path, ['en'])
             t.update(catalog._catalog)
         except IOError:
-            # 'en' catalog was missing. This is harmless.
+            if locale.startswith('en'):
+                # 'en' catalog was missing, but it is the selected language.
+                # This would cause issues later on if default_locale is
+                # something other than 'en'.
+                en_catalog_missing = True
+            # Otherwise it is harmless.
             pass
-    # next load the settings.LANGUAGE_CODE translations if it isn't english
-    if default_locale != 'en':
+    # next load the currently selected language, if it isn't english
+    if locale != 'en':
         for path in paths:
             try:
-                catalog = gettext_module.translation(domain, path, [default_locale])
-            except IOError:
-                catalog = None
-            if catalog is not None:
-                t.update(catalog._catalog)
-    # last load the currently selected language, if it isn't identical to the default.
-    if locale != default_locale:
-        for path in paths:
-            try:
                 catalog = gettext_module.translation(domain, path, [locale])
             except IOError:
                 catalog = None
             if catalog is not None:
                 t.update(catalog._catalog)
+        # If the flag en_catalog_missing has been set, the currently
+        # selected language is English but it doesn't have a translation
+        # catalog (presumably due to being the language translated from).
+        # If that is the case, a wrong language catalog might have been
+        # loaded in the previous step. It needs to be discarded.
+        if en_catalog_missing:
+            t = {}
     src = [LibHead]
     plural = None
     if '' in t:
