* @var array
*/
static public $durationIntervals = array(
- 'millennia' => 31557600000,
- 'centuries' => 3155760000,
- 'decades' => 315576000,
- 'years' => 31557600, // 86400 * 365.25
+ 'millennia' => 31556952000,
+ 'centuries' => 3155695200,
+ 'decades' => 315569520,
+ 'years' => 31556952, // 86400 * ( 365 + ( 24 * 3 + 25 ) / 400 )
'weeks' => 604800,
'days' => 86400,
'hours' => 3600,
* @return Language
*/
static function factory( $code ) {
- global $wgLangObjCacheSize;
+ global $wgDummyLanguageCodes, $wgLangObjCacheSize;
+
+ if ( isset( $wgDummyLanguageCodes[$code] ) ) {
+ $code = $wgDummyLanguageCodes[$code];
+ }
// get the language object to process
$langObj = isset( self::$mLangObjCache[$code] )
* @return string
*/
function listToText( array $l ) {
- $s = '';
$m = count( $l ) - 1;
-
- if ( $m === 0 ) {
- return $l[0];
- } elseif ( $m === 1 ) {
- return $l[0] . $this->getMessageFromDB( 'and' ) . $this->getMessageFromDB( 'word-separator' ) . $l[1];
- } else {
- for ( $i = $m; $i >= 0; $i-- ) {
- if ( $i == $m ) {
- $s = $l[$i];
- } elseif ( $i == $m - 1 ) {
- $s = $l[$i] . $this->getMessageFromDB( 'and' ) . $this->getMessageFromDB( 'word-separator' ) . $s;
- } else {
- $s = $l[$i] . $this->getMessageFromDB( 'comma-separator' ) . $s;
- }
+ if ( $m < 0 ) {
+ return '';
+ }
+ if ( $m > 0 ) {
+ $and = $this->getMessageFromDB( 'and' );
+ $space = $this->getMessageFromDB( 'word-separator' );
+ if ( $m > 1 ) {
+ $comma = $this->getMessageFromDB( 'comma-separator' );
}
- return $s;
}
+ $s = $l[$m];
+ for ( $i = $m - 1; $i >= 0; $i-- ) {
+ if ( $i == $m - 1 ) {
+ $s = $l[$i] . $and . $space . $s;
+ } else {
+ $s = $l[$i] . $comma . $s;
+ }
+ }
+ return $s;
}
/**