There have been many requests over the years to support non-gregorian calendar systems in Drupal. At the moment, Drupal is hard-wired to support only the Gregorian calendar. Any attempt to adjust that requires hacking core. While the actual provision of other calendars will most likely remain in contrib, core needs to be adjusted to make it possible to support other calendar systems more seamlessly. The main support that seems to be needed and required is to adjust the display of date information to match the calendar in question. Calendar systems each have their own idea of the names of the days of the week and the months of the year, how many days are in a month or a year, etc. Wherever we provide such lists, we should do it using a plugin so the values can be adjusted as needed.
The new Plugin system in D8 is a perfect time to make this change. I've created a patch that creates a calendar plugin system. Core would provide the gregorian calendar and the plugin infrastructure, and contrib can provide other calendars by implementing hook_datetime_calendar_info(). The plugin consists of an interface that defines methods like 'monthNames' and 'dayNames', which are populated by the selected calendar. Then everywhere we want to display things like option lists of day names, we use the plugin to retrieve those lists.
The patch also adds a new system configuration item for 'system.calendar' to store the desired default value, and adds that to the regional settings page, then uses it to determine which list of date elements to retrieve.
In addition to making it possible to support other calendar systems, this should be good for the multilingual system, because the translation of all those date elements is now concentrated in a single location and clearly specified, including not only the long names but also the abbreviations for those names.
This patch relies on and extends, so that patch must be applied to be able to evaluate this one. It's going to fail tests unless and until that patch is applied, but I'm marking it for review to get eyes on it. I'm hoping that if we can get the first patch in we can follow it up with this one.
|PASSED: [[SimpleTest]]: [MySQL] 48,075 pass(es).|
|FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1811912-calendar-translation-9.patch. Unable to apply patch. See the log in the details link for more information.|
|FAILED: [[SimpleTest]]: [MySQL] 46,189 pass(es), 180 fail(s), and 180 exception(s).|