LocaleInfo localeInfo=LocaleInfo.getCurrentLocale();
String locale=localeInfo.getLocaleName();
addToPopupSlot(loadingPresenter);
SetLanguage action=new SetLanguage(locale);
dispatchAsync.execute(action, setLanguageCallback);On Tuesday, July 29, 2014 4:07:47 PM UTC+10, Tom wrote:
Ok, I am developing an app that supports Internationalization. I am using
Static String Internationalizationmethod for my app.Let say my app can have English & German version, so -1st, I created
MyMessages.javawhich has all message texts written in English. Then I created anMyMessages_gewhich is almost the same asMyMessages.javaexcept that the text written in German-2nd, in
MyProject.htmli have<meta http-equiv="content-type" content="text/html; charset=UTF-8">to make sure it will support all languages-3rd, in
MyProject.gwt.xmlI have<extend-property name="locale" values="ge"/>Now I run my app in eclipse
http://localhost:8888/& it shows all the German text as I expected.MyProject.html?gwt.codesvr= 127.0.0.1:9997&locale=ge 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 thatlanguageCode=1if it is in English so server will use the default languagelanguageCode=0Here is what I did. At
HeaderPresenter.java@Override public void prepareFromRequest(PlaceRequest request){ super.prepareFromRequest( request); String locale=request.getParameter(" locale", ""); setLanguage(locale); // servercall back here } so when my app run first time it should let server to know which language the Gwt app is using
@Override public SetLanguageResult execute(SetLanguage action, ExecutionContext context) throws ActionException { String locale=action.getLocale(); if("ge".equals(locale)){ Data.languageType=1; } return null; }However, it doesn't seem work When I go to orderPage the url will be
http://localhost:8888/it not in the formMyProject.html?gwt.codesvr= 127.0.0.1:9997&locale=ge#! orderPage http://localhost:8888/that is why server couldn't capture theMyProject.html?gwt.codesvr= 127.0.0.1:9997#!orderPage; locale=ge localevalue.I think I misunderstood something here. I'm quite confusing.
So How to access "locale" value (of an Internationalization App) in server side in GWT?
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