[Zope-Checkins] CVS: Zope3/lib/python/Zope/I18n - Domain.py:1.5
Barry Warsaw
barry@wooz.org
Wed, 12 Jun 2002 16:50:20 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/I18n
In directory cvs.zope.org:/tmp/cvs-serv9102/lib/python/Zope/I18n
Modified Files:
Domain.py
Log Message:
Simplify and make placeless. There's no use case for Domains to be
placeful and we currently want this equivalence to be true:
translationService.translate(domain, msgid, ...)
translationService.getDomain(domain).translate(msgid, ...)
=== Zope3/lib/python/Zope/I18n/Domain.py 1.4 => 1.5 ===
from Zope.I18n.IDomain import IDomain
+from Zope.ComponentArchitecture import getServiceManager
class Domain:
__implements__ = IDomain
- def __init__(self, place, domain):
- self._place = place
- self.domain = domain
-
- def getPlace(self):
- """Return the place this domain was created for."""
- return self._place
+ def __init__(self, domain, service):
+ self._domain = domain
+ self._translationService = service
def getDomainName(self):
"""Return the domain name"""
@@ -39,10 +36,5 @@
def translate(self, msgid, mapping=None, context=None,
target_language=None):
"""See Zope.I18n.IDomain.IDomain"""
-
- # lookup the correct translation service
- service_manager = getServiceManager(self.place)
- service = service_manager.getBoundService('Translation Service')
-
- return service.translate(self.domain, source, mapping, context,
- target_language)
+ return self._translationService.translate(
+ self._domain, msgid, mapping, context, target_language)