If that format changes with the locale, why am I getting an entirely non-US
format?
Because you haven't specified a locale in your gwt.xml file. You're using
the DefaultLocale, not US. Default != US and you'll get other different
behavior. DatePicker will also have a different day that starts the day of
the week etc. If you're coding to the US locale, set it.
Well, I don't know how anyone else codes, but from my perspective, an
undocumented constant in a library is a useless constant, since the
amount of time and effort spent figuring out what it is and what it
does could better be spent just making my own constant that does what
I want. Which is what I've now done in this case.
You must not be writing an i18n app. In your case that will work fine. I'm
writing an app that needs i18n support and am very happy with the
functionality that the current implementation provides. I can create a
DateFormatter that does DATE_SHORT and will translate that to the format for
the appropriate locale.
Aside from that, I'd have to spend a fair amount of time trying to
figure out what each of those constants MEAN. Presumably the person /
people who wrote those comments did that in the first place. Which
leaves me with the question of why they didn't write that information
down, instead of writing down that some day they needed to do that?
And the other question of why the GWT Team allowed them to submit the
code when it was so obviously incomplete. Yes, I know that there's a
lot of volunteer labor that goes into GWT. But I would expect that
the pride and professionalism of all involved would demand that things
be done right, or not at all.
How would you represent DATE_SHORT in a concise manner that isn't US locale
centric.
/**
for us locales, this prints the date in a MM/dd/yyyy format
for default locale this prints the date in dd/MM/yyyy format
for ar locale ...
for jp locale ...
etc
**/
DATE_SHORT
There are a ton of Locales. This would get unwieldly and unreadable very
quickly. There are 2 really easy ways to figure out how this works. 1, try
it. 2, look at the backing .properties files for the locales you care
about.
note: I can't remember off the top of my head what DATE_SHORT means, so
don't shoot me if I got the formatting implementation wrong.
--
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.