Tuesday, July 29, 2014

Re: How to access “locale” value (of an Internationalization App) in server side in GWT?

Am 29.07.2014 08:07, schrieb Tom:

> However, I have a need to know that my app is German |At Server Side|.
> That means whenever my GWT Gui in German version then my server will
> know that |languageCode=1| if it is in English so server will use the
> default language |languageCode=0|

I solved it by adding the language code to the signature of the
methods of the servlet. The localization-file contains an entry
CURR_LANGUAGE (=de in the german resource, =en in the english one),
so a call on the client-side always look something like this
doSomething(param1, param2, param3, CONSTANTS.CURRLANGUAGE(), new Async...)

> However, it doesn't seem work When I go to orderPage the url will
> be |http://localhost:8888/MyProject.html?gwt.codesvr=127.0.0.1:9997&locale=ge#!orderPage|
> it not in the form |http://localhost:8888/MyProject.html?gwt.codesvr=127.0.0.1:9997#!orderPage;locale=ge|
> that is why server couldn't capture the |locale| value.

The Querystring of the URL starts with the gwt.codesvr, so I
assume the #!orderPage is in the wrong place. As well, sepa-
rating query-parameters by ; isn't correct, it must be &. So
the correct url should in my eyes be
http://localhost:8888/MyProject.html#!orderPage?gwt.codesvr=127.0.0.1:9997&locale=ge

BTW. GE is not the correct iso-value for german, it's de. You
should use these rather than inventing your own.


Cheers, Lothar

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment