I'm also looking for this kind of 'smart factory' to use localization
in my shared code.

One easy way (which is good enough for me), is MY.create() return
GWT.create() on client side and null on server side...
This solution may lead to null pointer exception.

If you find an elegant solution, please share it.
Thank

Vincent

On 22 sep, 10:04, Dobes <[EMAIL PROTECTED]> wrote:
> Hm, I see.  But would I be able to use GWT.create(...) to create the
> Constants subclass, and have it honor my @DefaultStringValue()
> annotations?
>
> I suppose not, so maybe I'd have to come up with some kind of clever
> factory scheme which uses GWT.create in client code and whatever my
> own implementation is in server code.
>
> I guess I'll have to give this some more thought, the code to work
> around this with extra client and server code that generates its own
> strings instead of generating strings in shared code might still be
> less work that implementing my own fancy GWT shared i18n stuff.
>
> On Sep 21, 6:13 am, Lothar Kimmeringer <[EMAIL PROTECTED]> wrote:
>
> > Dobes schrieb:
>
> > > I like the way GWT does it's localization and it would be great if I
> > > could use the same code in client AND server (especially, use it in my
> > > code that is shared between client and server).  Any idea how possible
> > > this is?
>
> > Actually there is no problem at all (OK there are two ;-)
> > On the server-side just create a resource-bundle, that is
> > reading in the property-files used by GWT to create the
> > localized HTML-pages.
>
> > Here comes the first problem. The property-files used for
> > GWT must be encoded in UTF-8, Java's resource-bundle
> > expects ISO-8859-1. But there are implementations out there
> > that can be used (GWT is using one as well that is mentioned
> > in the docs, so you might try that one out as well).
>
> > The other problem is that the algorithm used for loading
> > the correct resource-bundle differs from the one used
> > in GWT. Giving a Locale of e.g. "en_US" and the following
> > available resource-bundles
>
> >  - file_de.properties
> >  - file.properties
>
> > GWT loads file.properties all the time where Java loads
> > the de-files if the System-Locale is DE. As well, the
> > default-Locales of GWT for some languages are different
> > (AFAIK en_US instead of en_EN and es_AG instead of es_ES)
> > leading to funny effects when localizing e.g. currencies.
>
> > Regards, Lothar
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to