locale = to_locale(get_language())
- en_catalog_missing = False
+ en_selected = locale.startswith('en')
+ en_catalog_missing = True
# first load all english languages files for defaults
p = importlib.import_module(package)
catalog = gettext_module.translation(domain, path, ['en'])
- # 'en' catalog was missing.
- if locale.startswith('en'):
- # If 'en' 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.
+ # 'en' is the selected language and at least one of the packages
+ # listed in `packages` has an 'en' catalog
+ en_catalog_missing = False
# next load the settings.LANGUAGE_CODE translations if it isn't english
if default_locale != 'en':
# last load the currently selected language, if it isn't identical to the default.
if locale != default_locale:
- # 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 the currently selected language is English but it doesn't have a
+ # translation catalog (presumably due to being the language translated
+ # from) then a wrong language catalog might have been loaded in the
+ # previous step. It needs to be discarded.
+ if en_selected and en_catalog_missing: