Feature request: optional ITranslationDomain factory for registerTranslations

Bug #428882 reported by Ethan Jucovy
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Zope 3
Won't Fix
Undecided
Unassigned
zope.i18n
Won't Fix
Medium
Unassigned

Bug Description

It is useful to be able to override the default zope.i18n.translationdomain.TranslationDomain -- for example I have one override that always injects a certain value into the translation mapping, and another that prepends all new catalogs rather than appending them.

This is currently difficult without monkeypatching zope/i18n/zcml.py's `handler` or forking its `registerTranslations` function.

The attached patch adds an optional `factory` argument to both `registerTranslations` and `handler` so that custom ZCML directives can invoke `registerTranslations` with their choice of ITranslationDomain.

It might also be worth checking that the object returned by the provided `factory` implements (or can be adapted to?) ITranslationDomain, and preventing startup if it does not.

The <registerTranslations/> directive could also be extended with an optional `factory` parameter whose default is zope.i18n.translationdomain.TranslationDomain. This isn't necessary, though, and it's arguably cleaner to write new directives for particular overrides.

Revision history for this message
Ethan Jucovy (ethan-jucovy) wrote :
description: updated
Tres Seaver (tseaver)
Changed in zope3:
status: New → Won't Fix
Changed in zope.i18n:
importance: Undecided → Medium
status: New → Triaged
Revision history for this message
Tres Seaver (tseaver) wrote :
Changed in zope.i18n:
status: Triaged → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.