* (bug 8396) Ignore out-of-date serialised message caches
* (bug 12195) Undeleting pages now requires 'undelete' permission
* (bug 11810) Localize displayed semicolons
+* (bug 11657) Support for Thai solar calendar
=== Bug fixes in 1.12 ===
* xjn n (month number) in Hebrew calendar
* xjY Y (full year) in Hebrew calendar
*
+ * xkY Y (full year) in Thai solar calendar. Months and days are
+ * identical to the Gregorian calendar
+ *
* Characters enclosed in double quotes will be considered literal (with
* the quotes themselves removed). Unmatched quotes will be considered
* literal quotes. Example:
$rawToggle = false;
$iranian = false;
$hebrew = false;
+ $thai = false;
for ( $p = 0; $p < strlen( $format ); $p++ ) {
$num = false;
$code = $format[$p];
$code .= $format[++$p];
}
- if ( ( $code === 'xi' || $code == 'xj' ) && $p < strlen( $format ) - 1 ) {
+ if ( ( $code === 'xi' || $code == 'xj' || $code == 'xk' ) && $p < strlen( $format ) - 1 ) {
$code .= $format[++$p];
}
if ( !$hebrew ) $hebrew = self::tsToHebrew( $ts );
$num = $hebrew[0];
break;
+ case 'xkY':
+ if ( !$thai ) $thai = self::tsToThai( $ts );
+ $num = $thai[0];
+ break;
case 'y':
$num = substr( $ts, 2, 2 );
break;
return array( $hebrewYear, $month, $day );
}
+ /**
+ * Algorithm to convert Gregorian dates to Thai solar dates.
+ *
+ * Link: http://en.wikipedia.org/wiki/Thai_solar_calendar
+ *
+ * @param string $ts 14-character timestamp
+ * @return array converted year, month, day
+ */
+ private static function tsToThai( $ts ) {
+ $gy = substr( $ts, 0, 4 );
+ $gm = substr( $ts, 4, 2 );
+ $gd = substr( $ts, 6, 2 );
+
+ # Add 543 years to the Gregorian calendar
+ # Months and days are identical
+ $gy_thai = $gy + 543;
+
+ return array( $gy_thai, $gm, $gd );
+ }
+
+
/**
* Based on Carl Friedrich Gauss algorithm for finding Easter date.
* Used for Hebrew date.
NS_CATEGORY_TALK => 'คุยเรื่องหมวดหมู่',
);
+/**
+ * A list of date format preference keys which can be selected in user
+ * preferences. New preference keys can be added, provided they are supported
+ * by the language class's timeanddate(). Only the 5 keys listed below are
+ * supported by the wikitext converter (DateFormatter.php).
+ *
+ * The special key "default" is an alias for either dmy or mdy depending on
+ * $wgAmericanDates
+ */
+$datePreferences = array(
+ 'default',
+ 'thai',
+ 'mdy',
+ 'dmy',
+ 'ymd',
+ 'ISO 8601',
+);
+
+/**
+ * These are formats for dates generated by MediaWiki (as opposed to the wikitext
+ * DateFormatter). Documentation for the format string can be found in
+ * Language.php, search for sprintfDate.
+ *
+ * This array is automatically inherited by all subclasses. Individual keys can be
+ * overridden.
+ */
+$dateFormats = array(
+ 'thai time' => 'H:i',
+ 'thai date' => 'j F xkY',
+ 'thai both' => 'H:i, j F xkY',
+
+ 'mdy time' => 'H:i',
+ 'mdy date' => 'F j, Y',
+ 'mdy both' => 'H:i, F j, Y',
+
+ 'dmy time' => 'H:i',
+ 'dmy date' => 'j F Y',
+ 'dmy both' => 'H:i, j F Y',
+
+ 'ymd time' => 'H:i',
+ 'ymd date' => 'Y F j',
+ 'ymd both' => 'H:i, Y F j',
+
+ 'ISO 8601 time' => 'xnH:xni:xns',
+ 'ISO 8601 date' => 'xnY-xnm-xnd',
+ 'ISO 8601 both' => 'xnY-xnm-xnd"T"xnH:xni:xns',
+);
+
$linkTrail = '/^([a-z]+)(.*)\$/sD';
$messages = array(