Improve docs for locale-default calendar (was: Does locale have default calendar?)
I am busy implementing the DateTimeFormatter or DateFormatter into my i18n library crate, have it working with the non-experimental options.
From the examples of the docs for both DateTimeFormatter and DateFormatter, I have noted the inclusion of the -u-ca-? tag in creating the Locale object. Where ? represents any of the 8 calendars.
I am wondering if locales have a default calendar, like en uses gregorian, jp uses japanese, or must the calendar be explicit set in the locale using the -u-ca-? tag, whenever one wants to format a date using a DateTime or Date object?
Documentation is vague regarding default calendar.
For time and date the documentation mentions that the lengths to be set to medium when display options are not present.
Would it be reasonable to make Iso calendar the default for any locale?
If you use DateFormatter or DateTimeFormatter, the calendar is automatically chosen for the locale. According to the current CLDR release most locales default to gregory except a few that default to buddhist.
Seems like an area where docs could be improved.
Thanks for the prompt reply.
Correct to say that one only needs to add the Unicode extension calendar tag -u-ca-? to change from the locale's calendar default?
Current examples to me seem to indicate that there is no default calendar for locales.
Right, -u-ca allows the user to override their locale's default calendar.
Hi @rizzen-yazston, could you peruse the latest docs, which were rewritten in the 2.0 release, and give feedback on whether they are more clear?
https://unicode-org.github.io/icu4x/rustdoc/icu/datetime/index.html
Also note the new DateTimeFormatterPreferences struct that allows setting the calendar via an enum
https://unicode-org.github.io/icu4x/rustdoc/icu/datetime/struct.DateTimeFormatterPreferences.html
Hi @rizzen-yazston, still would be interested in your feedback!