Thanks,

After updating my javadoc the TranslatorAlternatesSource was quickly found. So for completeness sake, the following did the trick for me:

public static void contributeTranslatorAlternatesSource(MappedConfiguration<String, Translator> configuration) { Translator<BigDecimal> bdTranslator = new BigDecimalTranslator(); configuration.add(bdTranslator.getName(), bdTranslator);

Translator<BigDecimal> durationTranslator = new DurationTranslator(); configuration.add(durationTranslator.getName(), durationTranslator);
   }

Thanks,
Joost


Howard Lewis Ship wrote:
Please read the documentation on TranslatorSource about how to
accomplish what you want.

On Tue, May 11, 2010 at 4:16 AM, Joost Schouten (ml)
<joost...@jsportal.com> wrote:
Hi,

I just updated to the latest snapshot of T5.2 and can no longer contribute
two translators for the same type [1]. I get an exception due to the fact
that the TranslatorSource now only accepts a MappedConfiguration which
disallows two contributions on the same type [2].

Two translators on one type seems like a valid situation to me.

I understand I can pass a custom FieldTranslator in the translate parameter
but think that is less elegant than just defining the name or the translator
if I need something other than default.

Is this no longer possible or is there now a different way to contribute
multiple translators for one type?

Cheers,
Joost


[1]: My old AppModule contribution method which now no longer works:
public static void contributeTranslatorSource(Configuration<Translator>
configuration) {
          Translator<BigDecimal> bdTranslator = new BigDecimalTranslator();
           configuration.add(bdTranslator);

          Translator<BigDecimal> durationTranslator = new
DurationTranslator();            configuration.add(durationTranslator);
}

[2]: nor does this one, understandably:
public static void contributeTranslatorSource(MappedConfiguration<Class,
Translator> configuration) {
          Translator<BigDecimal> bdTranslator = new BigDecimalTranslator();
           configuration.add(BigDecimal.class, bdTranslator);

          Translator<BigDecimal> durationTranslator = new
DurationTranslator();            configuration.add(BigDecimal.class,
durationTranslator);
}

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org







---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to