[Zope3-checkins] CVS: Zope3/src/zope/tal - dummyengine.py:1.8

Jim Fulton jim@zope.com
Wed, 30 Apr 2003 10:31:15 -0400


Update of /cvs-repository/Zope3/src/zope/tal
In directory cvs.zope.org:/tmp/cvs-serv13687

Modified Files:
	dummyengine.py 
Log Message:
Added support for alternate domains.

If a given domain matches the name of a string method, then we
"translate" by calling that method (with no arguments). Otherwise we
translate by calling upper.

This was done so I could write a test for handling of i18n:domain.


=== Zope3/src/zope/tal/dummyengine.py 1.7 => 1.8 ===
--- Zope3/src/zope/tal/dummyengine.py:1.7	Thu Apr 17 16:05:14 2003
+++ Zope3/src/zope/tal/dummyengine.py	Wed Apr 30 10:31:14 2003
@@ -225,9 +225,15 @@
         # substrings.  Then upcase everything but the placeholders, then glue
         # things back together.
 
+        # If the domain is a string method, then transform the string
+        # by calling that method.
+
+
         # simulate an unknown msgid by returning None
         if msgid == "don't translate me":
             text = default
+        elif domain and hasattr('', domain):
+            text = getattr(msgid, domain)()
         else:
             text = msgid.upper()