[Wikipedia-l] Date format framework

Ævar Arnfjörð Bjarmason avarab at gmail.com
Sat Mar 26 04:01:15 UTC 2005


I've changed the date format framework so that languages other than
English can now have multiple date formats to be displayed in the user
interface, I've gone ahead and implemented this in the Icelandic and
Frysk language files, although the is. one is probably better for a
reference implementation. This is a call for patches against HEAD to
implement this in other languages.

To get an idea of how it works here's the $wgDateFormats array from
the LanguageIs.php file:

$wgDateFormatsIs = array(
        'Sjálfgefið',  <-- this means 'default' in Icelandic --> 
        '15. janúar 2001 kl. 16:12',
        '15. jan. 2001 kl. 16:12',
        '16:12, 15. janúar 2001',
        '16:12, 15. jan. 2001',
        'ISO 8601' => '2001-01-15 16:12:34'
);

The first option (number zero)  should be the "default", and that one
should then be handled by the time(), date() and timeanddate()
functions as an alias for the second option (number one), other
options should then come after that and there's no (sane) limit to how
many one can specify, the last one should then be the special ISO 8601
date identified by the array key 'ISO 8601', having this key
consistant across language files ensures that a user that chooses an
ISO date in one language will have that respected when sie changes
languages.

LanguageIs.php:
http://cvs.sourceforge.net/viewcvs.py/wikipedia/phase3/languages/LanguageIs.php?rev=HEAD&view=markup



More information about the Wikipedia-l mailing list