Hi Jens,
do you remember references for your tips??
Have anyone tested this solutions??
Thanks.
Em terça-feira, 14 de fevereiro de 2012 17h33min11s UTC-2, Jens escreveu:
>
> Just googled a bit because I have never thought about it and based on the
> search results I think I would try it the following way (untested):
>
> 1.) Send the current client side locale as a HTTP header (e.g.
> X-GWT-LOCALE) to the server using a custom RequestTransport for
> RequestFactory (extend DefaultRequestTransport and add the header).
>
> 2.) On server side create a new custom MessageInterpolator that can
> overwrite the locale:
>
> public class GwtClientLocaleMessageInterpolator implements
> MessageInterpolator {
>
> public GwtClientLocaleMessageInterpolator(MessageInterpolator default,
> Locale gwtClientLocale) {
> //remember parameters as fields
> }
>
> //implement methods by delegating to the default interpolator but
> overwriting the locale
>
> }
>
> 3.) On server side create a ServiceLayerDecorator for RequestFactory
> (extend RequestFactoryServlet and provide your decorator through a super
> call in the constructor) and change the way the Validation will be done in
> ServiceLayerDecorator.validate(..):
>
> MessageInterpolator defaultInterpolator =
> ValidatorFactory.getMessageInterpolator();
> GwtClientLocaleMessageInterpolator interpolator =
> new GwtClientLocaleMessageInterpolator(defaultInterpolator,
> localeFromGwtClient);
> Validator validator =
> ValidatorFactory.usingContext().interpolator(interpolator).getValidator();
> validator.validate(....);
>
>
> Hopefully you should now have messages based on the client GWT locale.
>
> -- J.
>
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-web-toolkit/-/QPafddJf8wQJ.
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.