Ticket #6376: gettext_domain.patch

File gettext_domain.patch, 1.7 KB (added by dennis@…, 17 years ago)

SImple and untested patch

  • django/conf/global_settings.py

     
    8989# If you set this to False, Django will make some optimizations so as not
    9090# to load the internationalization machinery.
    9191USE_I18N = True
    92 
    9392LOCALE_PATHS = ()
     93GETTEXT_DOMAIN = None
    9494
    9595# Not-necessarily-technical managers of the site. They get broken link
    9696# notifications and other various e-mails.
  • django/utils/translation/trans_real.py

     
    149149        if res is not None:
    150150            return res
    151151
    152         def _translation(path):
     152        def _translation(path, domain='django'):
    153153            try:
    154                 t = gettext_module.translation('django', path, [loc], klass)
     154                t = gettext_module.translation(domain, path, [loc], klass)
    155155                t.set_language(lang)
    156156                return t
    157157            except IOError, e:
     
    163163            t = _translation(path)
    164164            if t is not None:
    165165                if res is None:
    166                     return t
     166                    res = t
    167167                else:
    168168                    res.merge(t)
     169            if settings.GETTEXT_DOMAIN:
     170                t = _translation(path, settings.GETTEXT_DOMAIN)
     171                if t is not None:
     172                    if res is None:
     173                        res = t
     174                    else:
     175                        res.merge(t)
    169176            return res
    170177
    171178        for localepath in settings.LOCALE_PATHS:
Back to Top