Tuesday, May 31, 2011

Re: Using custom LocalMessages apart from Locales

You'll have to make factories/providers of your Messages/Constants interfaces, that you'll switch using deferred binding on the "other" property.

interface MyMessages extends Messages { … }
interface MyMessagesFactory {
  MyMessages get();
}
class Dist1MessagesFactory implements MyMessagesFactory {
  interface Dist1Messages extends MyMessages {
    // empty, only there for GWT to look for dist1-specific properties files
  }
  public MyMessages get() { return GWT.create(Dist1Messages.class); }
}
// similar for dist2 and dist3

Using deferred-binding, you'll <replace-with> MyMessagesFactory with one of Dist1MessagesFactory, Dist2MessagesFactory or Dist3MessagesFactory; and each one is using a "specialized" MyMessages interface with its set of properties files.

(you can of course use a generator with <generate-with> for MyMessagesFactory to automatically generate all specific implementations, instead of coding them by hand and using a <replace-with> rule)

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment