-
1. Re: Formatting dates using ERRAI localization
mbarkley Apr 8, 2014 10:22 AM (in response to jasper.oosterman)Hi Jasper,
I took a quick look at DateTimeFormat. It looks like you can pass in your own format String and furthermore all of the GWT locale implementations can be found in com.google.gwt.i18n.shared.impl.cldr. So here is how you could format the date for the "aa" locale:
DateTimeFormat.getFormat(new DateTimeFormatInfoImpl_aa().dateFormatFull()).format(new Date());
If you want an easy way to update lots of elements to new dates all at once, you could check out the StyleBindings. (Note: the example method in the docs takes a Style object, but it is also possible to take an Element as a parameter.) You could make a StyleBinding for localized date data-fields that uses GWT code like the example above. Then whenever you switch locales, you could simply call
StyleBindingsRegistry.get().updateStyles();
Hope that helps.
-
2. Re: Formatting dates using ERRAI localization
jasper.oosterman Apr 15, 2014 4:28 AM (in response to mbarkley)Ah, I was under the impression the GWT would compile out all localization info which were not specified in the .gwt.xml but that does not seem to be the case.
Thank for the pointer to the stylebindings, a sort of onload function for each element, works like a charm. If I would like to have the manual changed such that it becomes clear that both Style and Element objects are allowed as parameter, how do I go about that?
-
3. Re: Formatting dates using ERRAI localization
mbarkley Apr 15, 2014 9:42 AM (in response to jasper.oosterman)Glad to hear that's working for you.
If I would like to have the manual changed such that it becomes clear that both Style and Element objects are allowed as parameter, how do I go about that?
The Errai docs are all written in asciidoc, and you can make a pull request to them here. We would very much appreciate any contribution you have time to make
Cheers.