Index: src/zope/i18n/zcml.py =================================================================== --- src/zope/i18n/zcml.py (revision 103877) +++ src/zope/i18n/zcml.py (working copy) @@ -1,4 +1,5 @@ + # ############################################################################## # # Copyright (c) 2001, 2002 Zope Corporation and Contributors. @@ -50,13 +51,14 @@ return lang in config.ALLOWED_LANGUAGES -def handler(catalogs, name): +def handler(catalogs, name, factory=None): """ special handler handling the merging of two message catalogs """ gsm = getGlobalSiteManager() # Try to get an existing domain and add the given catalogs to it + factory = factory or TranslationDomain domain = queryUtility(ITranslationDomain, name) if domain is None: - domain = TranslationDomain(name) + domain = factory(name) gsm.registerUtility(domain, ITranslationDomain, name=name) for catalog in catalogs: domain.addCatalog(catalog) @@ -64,7 +66,7 @@ domain.addCatalog(TestMessageCatalog(name)) -def registerTranslations(_context, directory): +def registerTranslations(_context, directory, _factory=None): path = os.path.normpath(directory) domains = {} @@ -101,7 +103,7 @@ _context.action( discriminator = None, callable = handler, - args = (catalogs, name)) + args = (catalogs, name, _factory)) # also register the interface for the translation utilities provides = ITranslationDomain