[Zope3-checkins] SVN: Zope3/trunk/src/zope/i18n/ Teach the i18n
package about the new Message class so that translation works.
Gary Poster
gary at zope.com
Fri Apr 15 12:19:10 EDT 2005
Log message for revision 30006:
Teach the i18n package about the new Message class so that translation works.
Changed:
U Zope3/trunk/src/zope/i18n/__init__.py
U Zope3/trunk/src/zope/i18n/messageid.py
-=-
Modified: Zope3/trunk/src/zope/i18n/__init__.py
===================================================================
--- Zope3/trunk/src/zope/i18n/__init__.py 2005-04-15 16:17:58 UTC (rev 30005)
+++ Zope3/trunk/src/zope/i18n/__init__.py 2005-04-15 16:19:09 UTC (rev 30006)
@@ -19,6 +19,7 @@
import warnings
from zope.component import queryUtility
from zope.i18nmessageid import MessageIDFactory, MessageID
+from zope.i18nmessageid import MessageFactory, Message
from zope.i18n.interfaces import ITranslationDomain
# Set up regular expressions for finding interpolation variables in text.
@@ -33,9 +34,11 @@
def _translate(msgid, domain=None, mapping=None, context=None,
target_language=None, default=None):
- if isinstance(msgid, MessageID):
+ if isinstance(msgid, (MessageID, Message)):
domain = msgid.domain
default = msgid.default
+ if default is None:
+ default = msgid
mapping = msgid.mapping
util = queryUtility(ITranslationDomain, domain)
Modified: Zope3/trunk/src/zope/i18n/messageid.py
===================================================================
--- Zope3/trunk/src/zope/i18n/messageid.py 2005-04-15 16:17:58 UTC (rev 30005)
+++ Zope3/trunk/src/zope/i18n/messageid.py 2005-04-15 16:19:09 UTC (rev 30006)
@@ -13,3 +13,4 @@
##############################################################################
"$Id$"
from zope.i18nmessageid import MessageID, MessageIDFactory
+from zope.i18nmessageid import Message, MessageFactory
More information about the Zope3-Checkins
mailing list