Add pluggable calendar backend to core and centralize date translation

Created on 13 October 2012, over 12 years ago
Updated 17 April 2025, 5 days ago

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 #1802278: Add a Date component to core β†’ , 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.

✨ Feature request
Status

Postponed: needs info

Version

11.0 πŸ”₯

Component

system.module

Created by

πŸ‡ΊπŸ‡ΈUnited States KarenS

Live updates comments and jobs are added and updated live.
  • D8MI

    (Drupal 8 Multilingual Initiative) is the tag used by the multilingual initiative to mark core issues (and some contributed module issues). For versions other than Drupal 8, use the i18n (Internationalization) tag on issues which involve or affect multilingual / multinational support. That is preferred over Translation.

  • stale-issue-cleanup

    To track issues in the developing policy for closing stale issues, [Policy, no patch] closing older issues

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Thank you for sharing your idea for improving Drupal.

    We are working to decide if this proposal meets the Criteria for evaluating proposed changes. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or there is no community support. Your thoughts on this will allow a decision to be made.

    Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.

    Thanks!

  • πŸ‡¬πŸ‡§United Kingdom hadi farnoud

    it was a good idea but never got any attention from core devs. what a shame

  • πŸ‡ΊπŸ‡ΈUnited States nicxvan

    @hadi farnoud the good news is you can work on this if you still think it's valid, there is a create issue fork button at the top.
    If you press that it will create a fork you can begin.

    There is a patch to start with, but it's 13 years out of date.

Production build 0.71.5 2024