[Zope-Checkins] CVS: Zope3/lib/python/Zope/TAL - driver.py:1.30.6.1

Barry Warsaw barry@wooz.org
Tue, 25 Jun 2002 20:06:37 -0400


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

Modified Files:
      Tag: tal-i18n-refactor-branch
	driver.py 
Log Message:
First pass at refactoring the i18n tal attribute handling.  Some stuff
works better, some stuff is broken (which is why this is on a
branch).  In particular i18n:name + tal:content now works, as does
i18n:name + implicit tal:replace, but i18n:name + (explicit)
tal:replace is broken.  Checkpointing so I can work on this at home.

Specific changes:

TestTranslations.translate(): Added some new fake message ids.

TestEngine.evaluatePathOrVar(): Added a new fake expression.

ENGINES: Use the TestEngine for more test files.


=== Zope3/lib/python/Zope/TAL/driver.py 1.30 => 1.30.6.1 ===
         Leave TAL/METAL attributes in output
     -i
-        Leave I18N substitution strings un-interpolated
+        Leave I18N substitution strings un-interpolated.
 """
 
 import os
@@ -58,6 +58,13 @@
             return '%(minutes)s minutes after %(hours)s %(ampm)s' % mapping
         elif msgid == 'jobnum':
             return '%(jobnum)s is the JOB NUMBER' % mapping
+        elif msgid == 'verify':
+            s = 'Your contact email address is recorded as %(email)s'
+            return s % mapping
+        elif msgid == 'mailto:${request/submitter}':
+            return 'mailto:bperson@dom.ain'
+        elif msgid == 'origin':
+            return '%(name)s was born in %(country)s' % mapping
         return DummyTranslationService.translate(self, domain, msgid,
                                                  mapping, context,
                                                  target_language)
@@ -75,6 +82,8 @@
                     }
         elif expr == 'context/@@object_name':
             return '7'
+        elif expr == 'request/submitter':
+            return 'aperson@dom.ain'
         return DummyEngine.evaluatePathOrVar(self, expr)
 
 
@@ -84,6 +93,10 @@
 ENGINES = {'test23.html': TestEngine,
            'test24.html': TestEngine,
            'test26.html': TestEngine,
+           'test27.html': TestEngine,
+           'test28.html': TestEngine,
+           'test29.html': TestEngine,
+           'test30.html': TestEngine,
            }
 
 def usage(code, msg=''):