Main sidebar
|
PITS /
01418: Please add ordinals to ftime{} markup expressionsSummary: Please add ordinals to ftime{} markup expressions
Created: 2017-08-19 07:58
Status: Closed, added for 2.3.0
Category: Feature
From: XES
Assigned:
Priority: 1
Version:
OS:
Description: Request simple additional markup for ftime{} per suggestion on the php strftime() page. This will allow adding ordinals to date output for English output per the date() 'S' parameter. Suggested code from comment on PHP documentation page: function my_strftime ($format, $timestamp) { $format = str_replace('%O', date('S', $timestamp), $format); return strftime($format, $timestamp); } XES August 19, 2017, at 07:59 AM While this is very easy to add, the " And unfortunately, PHP does not localize these, unlike the month and day names (though not a reason to not enable it, at least for English). --Petko August 19, 2017, at 08:32 AM I think you'd want to use something that would be very unlikely to assigned as a strftime format, e.g. " Not a problem -- I was just showing what the comment on the strftime() page showed. Absolutely not picky about the convention used. Not all websites require i8n, such as local websites for local events. But it's nice to be able to say an event will be on Wednesday the 8th of November. XES September 05, 2017, at 10:52 AM -- I believe in translations, the markup would be ignored.
With PHP 8.1, the function strftime is deprecated, so it is very unlikely for new formats to be added. So I've added the "%o" format as an ordinal suffix with the new PSFT() function. See Functions#PSFT. Note that using the function before PHP 8.1, and without English
French
Note that the pmwiki.org server doesn't have the PHP 'intl' extension loaded, so the ordinal suffixes are in English (but the French locale is installed for strftime so the month name is in French). On my own wiki the ordinal suffixes are correctly in French. See PmWiki.Functions#PSFT. --Petko January 01, 2022, at 07:09 PM Looking at it again, in French dates, the "1st" may be written as "1er" ("premier"), but all other dates are just read as cardinal numbers (normal), as in "the two January". So I probably wouldn't use "%o" for dates in French. --Petko January 02, 2022, at 01:53 PM |