Ticket #5581: views_i18n_py.patch

File views_i18n_py.patch, 1.3 KB (added by Benoit Chesneau <bchesneau@…>, 8 years ago)
  • i18n.py

     
    110110        packages = ['django.conf']
    111111    if type(packages) in (str, unicode):
    112112        packages = packages.split('+')
    113     packages = [p for p in packages if p == 'django.conf' or p in settings.INSTALLED_APPS]
     113    #packages = [p for p in packages if p == 'django.conf' or p in settings.INSTALLED_APPS]
    114114    default_locale = to_locale(settings.LANGUAGE_CODE)
    115115    locale = to_locale(get_language())
    116116    t = {}
    117117    paths = []
    118118    # first load all english languages files for defaults
    119119    for package in packages:
    120         p = __import__(package, {}, {}, [''])
    121         path = os.path.join(os.path.dirname(p.__file__), 'locale')
    122         paths.append(path)
    123         catalog = gettext_module.translation(domain, path, ['en'])
    124         t.update(catalog._catalog)
     120        try:
     121            p = __import__(package, {}, {}, [''])
     122            path = os.path.join(os.path.dirname(p.__file__), 'locale')
     123            paths.append(path)
     124            catalog = gettext_module.translation(domain, path, ['en'])
     125            t.update(catalog._catalog)
     126        except:
     127            continue
    125128    # next load the settings.LANGUAGE_CODE translations if it isn't english
    126129    if default_locale != 'en':
    127130        for path in paths:
Back to Top