[Zope-Checkins] CVS: Zope3/lib/python/Zope/I18n - SimpleTranslationService.py:1.2

Barry Warsaw barry@wooz.org
Wed, 12 Jun 2002 16:58:13 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/I18n
In directory cvs.zope.org:/tmp/cvs-serv11539/lib/python/Zope/I18n

Modified Files:
	SimpleTranslationService.py 
Log Message:
Code cleanup, get rid of some trailing whitespace.

translate(): Fix and simplify through use of a list comprehension.

getDomain(): switch the order of the arguments to Domain.__init__() to
match the actual implementation.


=== Zope3/lib/python/Zope/I18n/SimpleTranslationService.py 1.1 => 1.2 ===
     # Zope.I18n.ITranslationService.
 
-    def translate(self, domain, msgid, mapping=None, context=None,  
+    def translate(self, domain, msgid, mapping=None, context=None,
                   target_language=None):
         '''See interface ITranslationService'''
-
         # Find out what the target language should be
         if target_language is None:
             if context is None:
                 raise TypeError, 'No destination language'
             else:
-                avail_langs = map(lambda m: m[2], self.messages.keys())
+                langs = [m[1] for m in self.messages.keys()]
                 # Let's negotiate the language to translate to. :)
                 negotiator = getService(self, 'LanguageNegotiation')
-                target_language = negotiator.getLanguage(avail_langs, context)
+                target_language = negotiator.getLanguage(langs, context)
 
         # Make a raw translation without interpolation
         text = self.messages.get((domain, target_language, msgid), msgid)
@@ -82,7 +81,7 @@
 
     def getDomain(self, domain):
         '''See interface ITranslationService'''
-        return Domain(self, domain)
+        return Domain(domain, self)
 
     #
     ############################################################