[Zope3-checkins] CVS: Zope3/src/zope/i18n - globaltranslationservice.py:1.11

Stephan Richter srichter at cosmos.phy.tufts.edu
Wed Aug 6 11:36:44 EDT 2003


Update of /cvs-repository/Zope3/src/zope/i18n
In directory cvs.zope.org:/tmp/cvs-serv16501/i18n

Modified Files:
	globaltranslationservice.py 
Log Message:
If we have an empty message id, just return an empty string; do not worry
about going through the entire machinery.


=== Zope3/src/zope/i18n/globaltranslationservice.py 1.10 => 1.11 ===
--- Zope3/src/zope/i18n/globaltranslationservice.py:1.10	Fri Jun  6 15:29:09 2003
+++ Zope3/src/zope/i18n/globaltranslationservice.py	Wed Aug  6 10:36:09 2003
@@ -66,6 +66,12 @@
     def translate(self, msgid, domain=None, mapping=None, context=None,
                   target_language=None, default=None):
         '''See interface ITranslationService'''
+
+        # if the msgid is empty, let's save a lot of calculations and return
+        # an empty string.
+        if msgid == u'':
+            return u''
+
         if target_language is None and context is not None:
             # Try to determine target language from context
             langs = [m[0] for m in self._catalogs.keys()]




More information about the Zope3-Checkins mailing list