Ticket #3594: javascript_translation_catalog.patch
File javascript_translation_catalog.patch, 1.7 KB (added by , 15 years ago) |
---|
-
django/views/i18n.py
126 126 locale = to_locale(get_language()) 127 127 t = {} 128 128 paths = [] 129 en_catalog_missing = False 129 130 # first load all english languages files for defaults 130 131 for package in packages: 131 132 p = __import__(package, {}, {}, ['']) … … 135 136 catalog = gettext_module.translation(domain, path, ['en']) 136 137 t.update(catalog._catalog) 137 138 except IOError: 138 # 'en' catalog was missing. This is harmless. 139 if locale.startswith('en'): 140 # 'en' catalog was missing, but it is the selected language. 141 # This would cause issues later on if default_locale is 142 # something other than 'en'. 143 en_catalog_missing = True 144 # Otherwise it is harmless. 139 145 pass 140 146 # next load the settings.LANGUAGE_CODE translations if it isn't english 141 147 if default_locale != 'en': … … 155 161 catalog = None 156 162 if catalog is not None: 157 163 t.update(catalog._catalog) 164 # If the flag en_catalog_missing has been set, the currently 165 # selected language is English but it doesn't have a translation 166 # catalog (presumably due to being the language translated from). 167 # If that is the case, a wrong language catalog might have been 168 # loaded in the previous step. It needs to be discarded. 169 if en_catalog_missing: 170 t = {} 158 171 src = [LibHead] 159 172 plural = None 160 173 if '' in t: