[
https://issues.apache.org/jira/browse/TAP5-45?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12654777#action_12654777
]
Christian Köberl commented on TAP5-45:
--------------------------------------
We have decorated the TranslatorSource service to achieve this:
public class I18nTranslatorSourceDecorator implements TranslatorSource. Then we
made our own service I18nTranslatorSource to contribute to.
In the class I18nTranslatorSourceDecorator we delegate all methods after
checking in I18nTranslatorSource, eg:
public Translator findByType(Class valueType)
{
Translator t = i18nTSource.findByType(valueType);
if (t == null)
{
return delegate.findByType(valueType);
}
return t;
}
This works, but there could be an easier and nicer way.
> Allow override default translator
> ---------------------------------
>
> Key: TAP5-45
> URL: https://issues.apache.org/jira/browse/TAP5-45
> Project: Tapestry 5
> Issue Type: Improvement
> Components: tapestry-ioc
> Affects Versions: 5.0.15
> Environment: All
> Reporter: Ville Virtanen
> Fix For: 5.1.0.0
>
>
> Tapestry should allow developer to override shipped default translators and
> add new ones. This should be done by allowing the configuration of the
> translator source, so that developers are not forced to use the translator
> tag on every field. :)
> If you try to:
> public void contributeTranslatorSource(MappedConfiguration<String,
> Translator> configuration)
> {
> configuration.add("double", new LocalizedDoubleTranslator());
> }
> It results in:
> [WARN] TapestryModule.TranslatorSource Service contribution (to service
> 'TranslatorSource', by
> fi.abo.eblanketter.tapestry5.services.AppModule.contributeTranslatorSource(MappedConfiguration)
> (at AppModule.java:224)) conflicts with existing contribution (by
> org.apache.tapestry5.services.TapestryModule.contributeTranslatorSource(MappedConfiguration)
> (at TapestryModule.java:609)) and has been ignored.
> Is it possible to assign alias to this translator to override it?
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]