diff options
author | Godefroid Chapelle <gotcha@bubblenet.be> | 2012-09-03 14:37:09 +0000 |
---|---|---|
committer | Godefroid Chapelle <gotcha@bubblenet.be> | 2012-09-03 14:37:09 +0000 |
commit | 6304cdfafb5c11ecbc81512a20e4835b4ebcbd9d (patch) | |
tree | 7b99fd7ca5668cedf32f5060d9a2ddb0dfba1858 | |
parent | cb484dd27562b503beb1362f917d436af717f4eb (diff) | |
download | zope-i18n-6304cdfafb5c11ecbc81512a20e4835b4ebcbd9d.tar.gz |
log DEBUG when loading translations from directories
-rw-r--r-- | src/zope/i18n/zcml.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/zope/i18n/zcml.py b/src/zope/i18n/zcml.py index 018f851..4ab9af1 100644 --- a/src/zope/i18n/zcml.py +++ b/src/zope/i18n/zcml.py @@ -17,6 +17,7 @@ __docformat__ = 'restructuredtext' import os +import logging from glob import glob from zope.component import getSiteManager @@ -34,6 +35,9 @@ from zope.i18n.translationdomain import TranslationDomain from zope.i18n.interfaces import ITranslationDomain +logger = logging.getLogger("zope.i18n") + + class IRegisterTranslationsDirective(Interface): """Register translations with the global site manager.""" @@ -75,6 +79,7 @@ def registerTranslations(_context, directory, domain='*'): path = os.path.normpath(directory) domains = {} + loaded = False # Gettext has the domain-specific catalogs inside the language directory, # which is exactly the opposite as we need it. So create a dictionary that # reverses the nesting. @@ -92,11 +97,14 @@ def registerTranslations(_context, directory, domain='*'): compile_mo_file(name, lc_messages_path) for domain_path in glob(os.path.join(lc_messages_path, '%s.mo' % domain)): + loaded = True domain_file = os.path.basename(domain_path) name = domain_file[:-3] if not name in domains: domains[name] = {} domains[name][language] = domain_path + if loaded: + logger.debug('register directory %s' % directory) # Now create TranslationDomain objects and add them as utilities for name, langs in domains.items(): |