Last modified: 2014-09-23 23:33:40 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 8385 - Adding other calendars
Adding other calendars
Status: NEW
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
unspecified
All All
: Low enhancement with 9 votes (vote)
: ---
Assigned To: Nobody - You can work on this!
: i18n, patch, patch-need-review
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-12-25 18:46 UTC by Yaakov Shoham
Modified: 2014-09-23 23:33 UTC (History)
9 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
the patch file for all described things (29.73 KB, patch)
2006-12-25 18:48 UTC, Yaakov Shoham
Details

Description Yaakov Shoham 2006-12-25 18:46:29 UTC
Here is a patch file for adding some official calendars, to use in
user-perefences-date (WatchList etc.) or even in system-date (default for users,
<nowiki>~~~~, ~~~~~</nowiki>).

The calendars that are patched here are:
* [J]ewish (Hebrew, Israeli) calendar (languages msgs updated: he, en)
* [I]slamic (Muslim, Hijri, Arabic) calendar (languages msgs updated: ar, en)
* [P]ersian (Iranian, Jalāli) calendar (languages msgs updated: fa, ku, en)
* [S]aka (Indian national) calendar (languages msgs updated: hi, en)

A new file was created – Calendars.php. It contains converesions from the
Gregorian date to the 4 dates above.

The file Language.php updated by:
* requiring Calendars.php
* adding some arrays & 'get'-functions for month names
* changing "sprintfDate" function, by:
  * adding option to use all those calendars (see in the documentation)
  * adding option to use Hebrew-Gematria for Jewish dates
* adding "hebrewNumeral" function for Hebrew-Gematria

The file Defines.php updated by adding 4 new symbols for those calendars.


I checked all the calendars, and they seem to work correctly.

Due to my ignorance in other languages, I didn't know how to write genitive
months in Arabic, Persian, Kurdish & Hindu, so I wrote them as non-genitive
months. Please, someone check it.
Comment 1 Yaakov Shoham 2006-12-25 18:48:16 UTC
Created attachment 2951 [details]
the patch file for all described things
Comment 2 JeLuF 2007-02-27 20:21:57 UTC
Why are you converting manually, instead of using PHP's calendar functions?

http://de.php.net/manual/en/ref.calendar.php
Comment 3 Aryeh Gregor (not reading bugmail, please e-mail directly) 2007-02-27 20:42:33 UTC
Since calendar functions are an optional part of the install, they may as well
be used only if they exist, with the patch's functions as fallbacks.
Comment 4 Yaakov Shoham 2007-03-01 05:18:34 UTC
At first I wrote just the Jewish calendar, and I used the PHP calendar
functions. [[user:rotemliss|]] adviced me to do it without this because it's
optional, as Simetrical said.
Also, as you can see, they don't support Islamic calendar, Persian calendar and
Saka calendar.
Comment 5 Rotem Liss 2007-11-13 17:20:03 UTC
Iranian calendar was added in r27184, and Hebrew calendar in r27461.
Comment 6 Huji 2007-11-13 18:29:15 UTC
To my knowledge (I try to investigate more about it) Islamic calendar is not this easy to convert; it is a lunar calendar, and still the beginning of some months (in particular Ramadan and Shawwal) is defined when the new moon is sighted. What offered in the patch by Shoham may be the best prediction method, but it is still not 100% accurate.
Comment 7 Sumana Harihareswara 2011-09-30 15:05:17 UTC
Yaakov Shoham, thank you for your patch.  Sorry for the wait in reviewing it!

Could you take a look at the most current version of MediaWiki (in Subversion trunk) and see whether your patch still cleanly applies?

You might also want to float this idea past the translatewiki.net people, to see if they have any ideas on how to implement this best.
Comment 8 Rotem Liss 2011-09-30 15:18:25 UTC
Iranian, Hebrew and Hijri calendars were all added. It seems that only the Indian calendar is still missing. Anyway, the patch should be changed to match the current structure of other calendars, in languages/Language.php.
Comment 9 reza1615 2011-11-17 17:55:36 UTC
Iranian calender (Jalaly) has bug in converting (under year 1600)

{{#time:xij xiF xiY|30 January 2010}}==>۱۰ بهمن ۱۳۸۸ (ok)

{{#time:xij xiF xiY|30 January 1600}}==>-۴۹ فروردین ۹۴۲ (not ok)

{{#time:xij xiF xiY|30 January 1599}}==>-۴۱۴ فروردین ۹۴۲ (not ok)

{{#time:xij xiF xiY|30 January 1598}}==>-۷۷۹ فروردین ۹۴۲ (not ok)

{{#time:xij xiF xiY|30 January 1597}}==>-۱۱۴۴ فروردین ۹۴۲ (not ok)
Comment 10 [no longer active user] 2013-10-24 12:58:48 UTC
@reza1615: interesting, 1600 is hard coded somehow on the algorithm https://github.com/wikimedia/mediawiki-core/blob/1bea3da95b2a5ee1f88ba617c559d111c2fc9a83/languages/Language.php#L1434 I think we should think about a replacement for it.
Comment 11 Huji 2013-10-24 15:09:06 UTC
I strongly discourage you from removing the hard-coded 1600 out of the algorithm, without consulting Rouzbeh Pournader (the original developer of that date conversion algorithm).

Please also notice that before a certain date, any conversions between Jalali and Gregorian calendar is inaccurate, for several reasons. For instance, before year 1304 Jalali, the calendar system was not officially used in any country, and there were 32 day months in Iran.

In short: date conversion is not a purely mathematical problem.
Comment 12 [no longer active user] 2013-10-24 15:12:41 UTC
I can not even if I want! :) I meant replacing with another algorithm. I am glad that you want solve it!

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links