[Checkins] SVN: zope.i18n/trunk/ log DEBUG when loading translations from directories

Godefroid Chapelle cvs-admin at zope.org
Mon Sep 3 14:37:13 UTC 2012


Log message for revision 127678:
  log DEBUG when loading translations from directories

Changed:
  _U  zope.i18n/trunk/
  U   zope.i18n/trunk/src/zope/i18n/zcml.py

-=-

Property changes on: zope.i18n/trunk
___________________________________________________________________
Modified: svn:ignore
   - bin
build
dist
lib
develop-eggs
eggs
parts
.installed.cfg

   + bin
build
dist
lib
include
develop-eggs
eggs
parts
.installed.cfg


Modified: zope.i18n/trunk/src/zope/i18n/zcml.py
===================================================================
--- zope.i18n/trunk/src/zope/i18n/zcml.py	2012-09-03 10:48:20 UTC (rev 127677)
+++ zope.i18n/trunk/src/zope/i18n/zcml.py	2012-09-03 14:37:09 UTC (rev 127678)
@@ -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.interfaces import ITranslationDomain
 
 
+logger = logging.getLogger("zope.i18n")
+
+
 class IRegisterTranslationsDirective(Interface):
     """Register translations with the global site manager."""
 
@@ -75,6 +79,7 @@
     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 @@
                     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():



More information about the checkins mailing list