cljs-time
cljs-time copied to clipboard
Support internationalised formatting
It would be very useful to get support for formatting dates in other languages than English, considering the amount of internationalised ClojureScript out there.
Google's closure library already has mature support for this so it might be a good idea to wrap the goog.i18n
module for human readable formatting: https://google.github.io/closure-library/api/goog.i18n.html
+1 Also highly interested in unparsing datetime objects into strings with months and weekdays names in other languages than English. Do you have plans to implement this?
I'd love for cljs-time to have i18n support, but as a typical anglophone I don't have any personal need for it. So unfortunately it's not that high on my priority list.
Would accept a PR ;)
Having thought about it, I'd like to do something about this. I'm working on a branch https://github.com/andrewmcveigh/cljs-time/pull/85
I'm not 100% sure on the API, but I think it would work as follows.
By default, cljs-time
would use the locale symbols set in goog.i18n.DateTimeSymbols
, but you could override this with the following code.
(cljs-time.format/with-locale (cljs-time.format/formatter "EEEE dd MMMM yyyy") "pt_BR")
Does that sound reasonable?
Thanks to @CarlosSam for contributing https://github.com/andrewmcveigh/cljs-time/pull/77
@andrewmcveigh , that sounds great! I think this is reasonable as it mimics clj-time (joda-time) API. Thank you for implementing this!
@andrewmcveigh , when do you plan to merge branch with i18n support into master and release a new version of cljs-time?
@andrewmcveigh I'm very interested in this as well.
Any update on this?