Pylons/deform — pull request #85 by dbaty (2012-03-30 12:48:17+00:00)
Title: Allow a custom i18n domain to be used for the "Add ${subitem_title}" link of a SequenceWidget

I can provide my own message for "SequenceWidget.add_subitem_text_template". This message is displayed as the "Add ${subitem_title}" link for a sequence schema.

The problem is that this message is inevitably processed under the "deform" i18n domain, as shown in this excerpt of 'SequenceWidget.serialize()' :

# '_' is defined in deform.i18n as TranslationStringFactory('deform')
add_subitem_text = _(self.add_subitem_text_template, mapping=add_template_mapping)

The attached commit fixes this bug and allows to provide a TranslationString that has a custom i18n domain. For example, I can now do this:

_ = TranslationStringFactory('my_app')
msg = _('Click here to add a ${subitem_title}')
widget = SequenceWidget(add_subitem_text_template=msg)