[Zope3-checkins] CVS: Zope3/src/zope/app/services/translation - filters.py:1.4 translationservice.py:1.9

Barry Warsaw barry@zope.com
Thu, 17 Apr 2003 16:05:43 -0400


Update of /cvs-repository/Zope3/src/zope/app/services/translation
In directory cvs.zope.org:/tmp/cvs-serv14704/src/zope/app/services/translation

Modified Files:
	filters.py translationservice.py 
Log Message:
Make the various i18n interfaces more consistent in their argument
order.  Some required domain before msgid, others had those two
reversed.  We standardize on msgid before domain because msgid can be
a MessageID instance which carries its domain around with it.  So in
that case we don't need to specify domain and can make it an argument
with a default value of None.

Update all found call sites of the old order, fixed interfaces and
tests.  Ran the tests and z3.py with Python 2.2.2 -- I hope I got them
all!


=== Zope3/src/zope/app/services/translation/filters.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/services/translation/filters.py:1.3	Fri Apr 11 13:54:03 2003
+++ Zope3/src/zope/app/services/translation/filters.py	Thu Apr 17 16:05:12 2003
@@ -69,8 +69,7 @@
         service = self.service
 
         for msgid in service.getMessageIdsOfDomain(domain):
-            msgstr = service.translate(domain, msgid,
-                                       target_language=language)
+            msgstr = service.translate(msgid, domain, target_language=language)
             msgstr = msgstr.encode('UTF-8')
             msgid = msgid.encode('UTF-8')
             output += _msg_template %(msgid, msgstr)


=== Zope3/src/zope/app/services/translation/translationservice.py 1.8 => 1.9 ===
--- Zope3/src/zope/app/services/translation/translationservice.py:1.8	Fri Apr 11 09:20:12 2003
+++ Zope3/src/zope/app/services/translation/translationservice.py	Thu Apr 17 16:05:12 2003
@@ -71,7 +71,7 @@
         self._unregisterMessageCatalog(object.getLanguage(),
                                        object.getDomain(), name)
 
-    def translate(self, domain, msgid, mapping=None, context=None,
+    def translate(self, msgid, domain=None, mapping=None, context=None,
                   target_language=None, default=None):
         """See interface ITranslationService"""
         if domain is None:
@@ -96,7 +96,7 @@
             # a translation server higher up the tree.
             ts = queryNextService(self, 'Translation')
             if ts is not None:
-                return ts.translate(domain, msgid, mapping, context,
+                return ts.translate(msgid, domain, mapping, context,
                                     target_language, default=default)
             else:
                 return default