Andreas Magnusson schrieb:
> Is there a way to just get support for formatting in all the locales
> that GWT has in com.google.gwt.i18n.client.Constants?
No, beacuse the classes don't exist inside the compiled
Javascript-result. If the values are coming from the
server-side, you can format them there by adding a
parameter "locale" to the list of parameters of the
method:
public MyDataResult getServerStatus(String locale){
MyDataResult res = new MyDataResult();
res.startDate = getServerStatus().getStartDate();
Locale l = getLocale();
DateFormat formatter =
SimpleDateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM, l);
res.startDateFormatted = formatter.format(res.startDate);
return res;
}
private Locale getLocale(String locale){
StringTokenizer tt = new StringTokenizer(locale, "_");
Locale loc = new Locale(tt.nextToken(), tt.hasMoreTokens() ? tt.nextToken() :
"", tt.hasMoreTokens() ? tt.nextToken() : "");
return loc;
}
The locale passed to the servlet can be read using JSNI (I don't
know if there is a way to get it via GWT already) or the servlet
reads in the corresponding HTTP-request-header (then you can
leave away the parameter or you use it as default if the parameter
is null).
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
-~----------~----~----~----~------~----~------~--~---