[Zope3-checkins] SVN: Zope3/branches/3.3/src/zope/app/i18n/t We do
need to provide a utility to query the next one;
see zope/app/component/README.txt.
Malthe Borch
mborch at gmail.com
Sat Oct 13 08:57:11 EDT 2007
Log message for revision 80859:
We do need to provide a utility to query the next one; see zope/app/component/README.txt.
Changed:
U Zope3/branches/3.3/src/zope/app/i18n/tests/test_translationdomain.py
U Zope3/branches/3.3/src/zope/app/i18n/translationdomain.py
-=-
Modified: Zope3/branches/3.3/src/zope/app/i18n/tests/test_translationdomain.py
===================================================================
--- Zope3/branches/3.3/src/zope/app/i18n/tests/test_translationdomain.py 2007-10-13 11:34:49 UTC (rev 80858)
+++ Zope3/branches/3.3/src/zope/app/i18n/tests/test_translationdomain.py 2007-10-13 12:57:11 UTC (rev 80859)
@@ -228,14 +228,15 @@
def setUp(self):
setup.placefulSetUp()
self.rootFolder = setup.buildSampleFolderTree()
- sm = zapi.getGlobalSiteManager()
+ gsm = zapi.getGlobalSiteManager()
de_catalog = MessageCatalog('de', 'default')
de_catalog.setMessage('short_greeting', 'Hallo!', 10)
+ de_catalog.setMessage('long_greeting', 'Guten Tag!', 10)
# register global translation domain and add the catalog.
domain = GlobalTranslationDomain('default')
- sm.registerUtility(domain, provided=ITranslationDomain, name='default')
domain.addCatalog(de_catalog)
+ gsm.registerUtility(domain, ITranslationDomain, 'default')
# create a local site manager and add a local translation domain
td = TranslationDomain()
@@ -245,7 +246,7 @@
td['de-default-1'] = de_catalog
mgr = setup.createSiteManager(zapi.traverse(self.rootFolder, 'folder1'))
- mgr.registerUtility(td, provided=ILocalTranslationDomain, name='default')
+ setup.addUtility(mgr, 'default', ILocalTranslationDomain, td)
self.trans1 = td
self.trans = domain
@@ -263,6 +264,11 @@
target_language='de'),
'Hallo Welt!')
+ self.assertEqual(
+ self.trans1.translate('long_greeting', 'default',
+ target_language='de'),
+ 'Guten Tag!')
+
def test_suite():
return unittest.TestSuite((
unittest.makeSuite(TestTranslationDomain),
Modified: Zope3/branches/3.3/src/zope/app/i18n/translationdomain.py
===================================================================
--- Zope3/branches/3.3/src/zope/app/i18n/translationdomain.py 2007-10-13 11:34:49 UTC (rev 80858)
+++ Zope3/branches/3.3/src/zope/app/i18n/translationdomain.py 2007-10-13 12:57:11 UTC (rev 80859)
@@ -82,7 +82,7 @@
else:
# If nothing found, delegate to a translation server higher up the
# tree.
- domain = queryNextUtility(ITranslationDomain, self.domain)
+ domain = queryNextUtility(self, ITranslationDomain, self.domain)
if domain is not None:
return domain.translate(msgid, mapping, context,
target_language, default=default)
More information about the Zope3-Checkins
mailing list