Thursday, December 2, 2010

Re: GWT 2.1 DateTimeFormat & locale changes?

I think I have solved my date/time issues by forcing a locale, but I
would welcome suggestions for a better solution.

In my module XML, I added the following line to include some
internationalization code:

<inherits name="com.google.gwt.i18n.I18N"/>

I added the following line to my module XML for my locale:

<extend-property name="locale" values="en_US"/>

Including the locale extend-property increases the GWT compile time,
since the compile does each browser/locale combination. This was the
most undesireable piece of my solution since it basically doubled my
GWT compile times. I tried to set the default locale using another bit
of XML found at http://code.google.com/intl/es-AR/webtoolkit/doc/latest/DevGuideI18nLocale.html#LocaleDefault,
but I could not even get the GWT compile to work when including that
XML.

The last required piece was adding the following line in my HTML file:

<meta name='gwt:property' content='locale=en_US'>

This gives it a default locale, but I believe that it can be
overridden with request parameters.

I did test this on a couple projects, and it worked for both. However,
I did not test with different locales. It seems that a new GWT 2.1
project has the same issues, so this is not just a GWT 2.0 conversion
problem -- I tested by adding a DateBox to a new GWT default project.


Enjoy,
Rick

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment