Uploaded image for project: 'Moodle Community Sites'
  1. Moodle Community Sites
  2. MDLSITE-7435

Add support to the LLLL format in lib/classes/date.php and langconfig (Moodle 4.4 onwards)



    • Improvement
    • Resolution: Unresolved
    • Low
    • lang.moodle.org
    • None


      Since Moodle 4.1 - the output of Moodle's stftime replacement function introduced differs from PHP's strftime in certain cases. One of the consequences is that - for languages where the "standalone" month form differs from the "format" form (cf. this info) the month names shown in e.g. calendar month headings display incorrectly in the genitive/partitive forms instead of the nominative.

      As concluded in the discussion under https://tracker.moodle.org/browse/MDLSITE-7370 , there is a need to add support to the LLLL format to enable correct and systematic handling of the standalone forms of months in multiple languages, among them Finnish, Polish or Russian. It has been agreed that we will develop such a solution for Moodle 4.4 and upwards under this new ticket.

      In short, there appears to be a need to have both LLLL and MMMM covered in the $intl_formats in lib/classes/date.php , and perhaps to update some lanconfig string definitions in selectes languages to associate "strftimemonth" and "strftimemonthyear" strings with the LLLL format, not MMMM.

      For Moodle 4.1, 4.2, and 4.3 - a workaround like this can be performed (with shell server access to the PHP code and local language pack customisation) : https://tracker.moodle.org/browse/MDLSITE-7370?focusedCommentId=1001956&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-1001956

      For Moodle 4.4 - we may have to wait until the voting for the required PHP version is over - cf. MDL-78496 - until we offer a final solution. The current (2023-11-01) Moodle 4.4dev master version requires only PHP 8.0, and since its lib/classes/date.php file is (still?) identical to the one bundled in Moodle 4.1 / 4.2 / 4,3, the above linked workaround should work.

      For the final release of Moodle 4.4 (scheduled for 22nd April, 2024), it has been observed by Heiko Schach that "PHP's IntlDatePatternGenerator with IntlDateFormatter could be used to generate ICU compliant strings for different languages, but unfortunately this is only available from PHP 8.1 onwards." - cf. https://tracker.moodle.org/browse/MDLSITE-7370?focusedCommentId=1002372&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-1002372 . Ergo, if Moodle 4.4 indeed starts requiring PHP8.1 (IMO this is likely), then the solution developed here could make use of the new PHP built-in functions.


        Issue Links



              Unassigned Unassigned
              pmk Przemek Kaszubski
              2 Vote for this issue
              3 Start watching this issue




                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.