Req #67425 [NEW]: Consider supporting functionality equivalent to MediaWiki's sprintfDate()
| From: | federicoleva at tiscali dot it | Date: | Thu, 12 Jun 2014 15:06:21 +0000 |
| Subject: | Req #67425 [NEW]: Consider supporting functionality equivalent to MediaWiki's sprintfDate() | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-186160@lists.php.net to get a copy of this message | ||
From: federicoleva at tiscali dot it
Operating system:
PHP version: 5.4.29
Package: Date/time related
Bug Type: Feature/Change Request
Bug description:Consider supporting functionality equivalent to MediaWiki's sprintfDate()
Description:
------------
MediaWiki, to support 300+ languages, has to work around some
limitations in PHP's date() which are less than optimal. However this
results into a large amount of code (often inspired from other tools)
and even larger amount of i18n improperly maintained in the codebase.
Clearly, in an ideal world this would be done directly in PHP with the
support of Unicode CLDR data/i18n. You probably already know but I'm
filing this just in case and as reference.
The main thing is sprintfDate():
https://git.wikimedia.org/blob/mediawiki%2Fcore.git/0444f9466366fe8cb04b9090045a07540ae56449/languages%2FLanguage.php#L1098
I'm attaching some excerpts for archival purposes.
Test script:
---------------
/**
* This is a workalike of PHP's date() function, but with better
* internationalisation, a reduced set of format characters, and a
better
* escaping format.
*
* Supported format characters are dDjlNwzWFmMntLoYyaAgGhHiscrUeIOPTZ.
See
* the PHP manual for definitions. There are a number of extensions,
which
* start with "x":
*
* xn Do not translate digits of the next numeric format
character
* xN Toggle raw digit (xn) flag, stays set until explicitly
unset
* xr Use roman numerals for the next numeric format character
* xh Use hebrew numerals for the next numeric format character
* xx Literal x
* xg Genitive month name
--
Edit bug report at https://bugs.php.net/bug.php?id=67425&edit=1
--