'math' => 1,
'rcdays' => 7,
'rclimit' => 50,
+ 'wllimit' => 250,
'highlightbroken' => 1,
'stubthreshold' => 0,
'previewontop' => 1,
* The array keys make up the set of formats which this language allows
* the user to select. It's exposed via Language::getDateFormats().
*
- * @access private
+ * @private
*/
$wgDateFormatsEn = array(
MW_DATE_DEFAULT => 'No preference',
'highlightbroken',
'justify',
'hideminor',
+ 'extendwatchlist',
'usenewrc',
'numberheadings',
'showtoolbar',
'autopatrol',
'forceeditsummary',
'watchlisthideown',
+ 'watchlisthidebots',
);
/* private */ $wgBookstoreListEn = array(
# ID CASE SYNONYMS
MAG_REDIRECT => array( 0, '#REDIRECT' ),
MAG_NOTOC => array( 0, '__NOTOC__' ),
+ MAG_NOGALLERY => array( 0, '__NOGALLERY__' ),
MAG_FORCETOC => array( 0, '__FORCETOC__' ),
MAG_TOC => array( 0, '__TOC__' ),
MAG_NOEDITSECTION => array( 0, '__NOEDITSECTION__' ),
MAG_CURRENTDAYNAME => array( 1, 'CURRENTDAYNAME' ),
MAG_CURRENTYEAR => array( 1, 'CURRENTYEAR' ),
MAG_CURRENTTIME => array( 1, 'CURRENTTIME' ),
+ MAG_NUMBEROFPAGES => array( 1, 'NUMBEROFPAGES' ),
MAG_NUMBEROFARTICLES => array( 1, 'NUMBEROFARTICLES' ),
MAG_NUMBEROFFILES => array( 1, 'NUMBEROFFILES' ),
+ MAG_NUMBEROFUSERS => array( 1, 'NUMBEROFUSERS' ),
MAG_PAGENAME => array( 1, 'PAGENAME' ),
MAG_PAGENAMEE => array( 1, 'PAGENAMEE' ),
MAG_NAMESPACE => array( 1, 'NAMESPACE' ),
MAG_NAMESPACEE => array( 1, 'NAMESPACEE' ),
- MAG_TALKSPACE => array( 1, 'TALKSPACE' ),
- MAG_TALKSPACEE => array( 1, 'TALKSPACEE' ),
- MAG_SUBJECTSPACE => array( 1, 'SUBJECTSPACE', 'ARTICLESPACE' ),
- MAG_SUBJECTSPACEE => array( 1, 'SUBJECTSPACEE', 'ARTICLESPACEE' ),
+ MAG_TALKSPACE => array( 1, 'TALKSPACE' ),
+ MAG_TALKSPACEE => array( 1, 'TALKSPACEE' ),
+ MAG_SUBJECTSPACE => array( 1, 'SUBJECTSPACE', 'ARTICLESPACE' ),
+ MAG_SUBJECTSPACEE => array( 1, 'SUBJECTSPACEE', 'ARTICLESPACEE' ),
MAG_FULLPAGENAME => array( 1, 'FULLPAGENAME' ),
MAG_FULLPAGENAMEE => array( 1, 'FULLPAGENAMEE' ),
- MAG_SUBPAGENAME => array( 1, 'SUBPAGENAME' ),
- MAG_SUBPAGENAMEE => array( 1, 'SUBPAGENAMEE' ),
- MAG_TALKPAGENAME => array( 1, 'TALKPAGENAME' ),
- MAG_TALKPAGENAMEE => array( 1, 'TALKPAGENAMEE' ),
- MAG_SUBJECTPAGENAME => array( 1, 'SUBJECTPAGENAME', 'ARTICLEPAGENAME' ),
- MAG_SUBJECTPAGENAMEE => array( 1, 'SUBJECTPAGENAMEE', 'ARTICLEPAGENAMEE' ),
+ MAG_SUBPAGENAME => array( 1, 'SUBPAGENAME' ),
+ MAG_SUBPAGENAMEE => array( 1, 'SUBPAGENAMEE' ),
+ MAG_BASEPAGENAME => array( 1, 'BASEPAGENAME' ),
+ MAG_BASEPAGENAMEE => array( 1, 'BASEPAGENAMEE' ),
+ MAG_TALKPAGENAME => array( 1, 'TALKPAGENAME' ),
+ MAG_TALKPAGENAMEE => array( 1, 'TALKPAGENAMEE' ),
+ MAG_SUBJECTPAGENAME => array( 1, 'SUBJECTPAGENAME', 'ARTICLEPAGENAME' ),
+ MAG_SUBJECTPAGENAMEE => array( 1, 'SUBJECTPAGENAMEE', 'ARTICLEPAGENAMEE' ),
MAG_MSG => array( 0, 'MSG:' ),
MAG_SUBST => array( 0, 'SUBST:' ),
MAG_MSGNW => array( 0, 'MSGNW:' ),
MAG_UC => array( 0, 'UC:' ),
MAG_RAW => array( 0, 'RAW:' ),
MAG_DISPLAYTITLE => array( 1, 'DISPLAYTITLE' ),
+ MAG_RAWSUFFIX => array( 1, 'R' ),
+ MAG_NEWSECTIONLINK => array( 1, '__NEWSECTIONLINK__' ),
+ MAG_CURRENTVERSION => array( 1, 'CURRENTVERSION' ),
+ MAG_URLENCODE => array( 0, 'URLENCODE:' ),
+ MAG_CURRENTTIMESTAMP => array( 1, 'CURRENTTIMESTAMP' ),
+ MAG_DIRECTIONMARK => array( 1, 'DIRECTIONMARK', 'DIRMARK' ),
+ MAG_LANGUAGE => array( 0, '#LANGUAGE:' ),
+ MAG_CONTENTLANGUAGE => array( 1, 'CONTENTLANGUAGE', 'CONTENTLANG' ),
+ MAG_PAGESINNAMESPACE => array( 1, 'PAGESINNAMESPACE:', 'PAGESINNS:' ),
+ MAG_NUMBEROFADMINS => array( 1, 'NUMBEROFADMINS' ),
);
if (!$wgCachedMessageArrays) {
class Language {
var $mConverter;
- function Language() {
-
- # Copies any missing values in the specified arrays from En to the current language
- $fillin = array( 'wgSysopSpecialPages', 'wgValidSpecialPages', 'wgDeveloperSpecialPages' );
- $name = get_class( $this );
-
- if( strpos( $name, 'language' ) == 0){
- $lang = ucfirst( substr( $name, 8 ) );
- foreach( $fillin as $arrname ){
- $langver = "{$arrname}{$lang}";
- $enver = "{$arrname}En";
- if( ! isset( $GLOBALS[$langver] ) || ! isset( $GLOBALS[$enver] ))
- continue;
- foreach($GLOBALS[$enver] as $spage => $text){
- if( ! isset( $GLOBALS[$langver][$spage] ) )
- $GLOBALS[$langver][$spage] = $text;
- }
- }
- }
+ function __construct() {
$this->mConverter = new fakeConverter($this);
}
/**
* Used by date() and time() to adjust the time output.
- * @access public
+ * @public
* @param int $ts the time in date('YmdHis') format
- * @param mixed $tz adjust the time by this amount (default false)
+ * @param mixed $tz adjust the time by this amount (default false,
+ * mean we get user timecorrection setting)
* @return int
*/
$tz = $wgUser->getOption( 'timecorrection' );
}
+ # minutes and hours differences:
+ $minDiff = 0;
+ $hrDiff = 0;
+
if ( $tz === '' ) {
- $hrDiff = isset( $wgLocalTZoffset ) ? $wgLocalTZoffset : 0;
- $minDiff = 0;
+ # Global offset in minutes.
+ if( isset($wgLocalTZoffset) ) {
+ $hrDiff = $wgLocalTZoffset % 60;
+ $minDiff = $wgLocalTZoffset - ($hrDiff * 60);
+ }
} elseif ( strpos( $tz, ':' ) !== false ) {
$tzArray = explode( ':', $tz );
$hrDiff = intval($tzArray[0]);
} else {
$hrDiff = intval( $tz );
}
+
+ # No difference ? Return time unchanged
if ( 0 == $hrDiff && 0 == $minDiff ) { return $ts; }
+ # Generate an adjusted date
$t = mktime( (
(int)substr( $ts, 8, 2) ) + $hrDiff, # Hours
(int)substr( $ts, 10, 2 ) + $minDiff, # Minutes
}
/**
- * @access public
+ * @public
* @param mixed $ts the time format which needs to be turned into a
* date('YmdHis') format with wfTimestamp(TS_MW,$ts)
* @param bool $adj whether to adjust the time output according to the
}
/**
- * @access public
+ * @public
* @param mixed $ts the time format which needs to be turned into a
* date('YmdHis') format with wfTimestamp(TS_MW,$ts)
* @param bool $adj whether to adjust the time output according to the
if ( $adj ) { $ts = $this->userAdjust( $ts, $timecorrection ); }
$datePreference = $this->dateFormat( $format );
- $sep = ($datePreference == MW_DATE_ISO)
- ? ':'
- : $this->timeSeparator( $format );
+ $sep = $this->timeSeparator( $format );
- $t = substr( $ts, 8, 2 ) . $sep . substr( $ts, 10, 2 );
+ $hh = substr( $ts, 8, 2 );
+ $mm = substr( $ts, 10, 2 );
+ $ss = substr( $ts, 12, 2 );
- if ( $datePreference == MW_DATE_ISO ) {
- $t .= $sep . substr( $ts, 12, 2 );
+ if ( $datePreference != MW_DATE_ISO ) {
+ $hh = $this->formatNum( $hh, true );
+ $mm = $this->formatNum( $mm, true );
+ //$ss = $this->formatNum( $ss, true );
+ return $hh . $sep . $mm;
+ } else {
+ return $hh . ':' . $mm . ':' . $ss;
}
- return $t;
}
/**
/**
* Return true if the time should display before the date.
* @return bool
- * @access private
+ * @private
*/
function timeBeforeDate() {
return true;
}
function formatDay( $day, $format ) {
- return $this->formatNum( 0 + $day );
+ return $this->formatNum( 0 + $day, true );
}
/**
- * @access public
+ * @public
* @param mixed $ts the time format which needs to be turned into a
* date('YmdHis') format with wfTimestamp(TS_MW,$ts)
* @param bool $adj whether to adjust the time output according to the
*/
function isRTL() { return false; }
+ /**
+ * A hidden direction mark (LRM or RLM), depending on the language direction
+ *
+ * @return string
+ */
+ function getDirMark() { return $this->isRTL() ? "\xE2\x80\x8F" : "\xE2\x80\x8E"; }
+
/**
* To allow "foo[[bar]]" to extend the link over the whole word "foobar"
*
*/
function linkPrefixExtension() { return false; }
-
function &getMagicWords() {
global $wgMagicWordsEn;
return $wgMagicWordsEn;
function getMagic( &$mw ) {
$raw = $this->getMagicWords();
- wfRunHooks( 'LanguageGetMagic', array( &$raw ) );
+ wfRunHooks( 'LanguageGetMagic', array( &$raw, $this->getCode() ) );
if( !isset( $raw[$mw->mId] ) ) {
# Fall back to English if local list is incomplete
/**
* Italic is unsuitable for some languages
*
- * @access public
+ * @public
*
* @param string $text The text to be emphasized.
* @return string
return "<em>$text</em>";
}
- /**
- * This function enables formatting of numbers, it should only come
- * into effect when the $wgTranslateNumerals variable is TRUE.
- *
+ /**
* Normally we output all numbers in plain en_US style, that is
* 293,291.235 for twohundredninetythreethousand-twohundredninetyone
* point twohundredthirtyfive. However this is not sutable for all
*
* @todo check if it's viable to use localeconv() for the decimal
* seperator thing.
- * @access public
+ * @public
* @param mixed $number the string to be formatted, should be an integer or
* a floating point number.
- * @param bool $year are we being passed a year? (turns off commafication)
- * @return mixed whatever we're fed if it's a year, a string otherwise.
+ * @param bool $nocommafy Set to true for special numbers like dates
+ * @return string
*/
- function formatNum( $number, $year = false ) {
- return $year ? $number : $this->commafy($number);
+ function formatNum( $number, $nocommafy = false ) {
+ global $wgTranslateNumerals;
+ if (!$nocommafy) {
+ $number = $this->commafy($number);
+ $s = $this->separatorTransformTable();
+ if (!is_null($s)) { $number = strtr($number, $s); }
+ }
+
+ if ($wgTranslateNumerals) {
+ $s = $this->digitTransformTable();
+ if (!is_null($s)) { $number = strtr($number, $s); }
+ }
+
+ return $number;
}
/**
return strrev((string)preg_replace('/(\d{3})(?=\d)(?!\d*\.)/','$1,',strrev($_)));
}
+ function digitTransformTable() {
+ return null;
+ }
+
+ function separatorTransformTable() {
+ return null;
+ }
+
+
/**
* For the credit list in includes/Credits.php (action=credits)
*
* @return string
*/
function convertGrammar( $word, $case ) {
+ global $wgGrammarForms;
+ if ( isset($wgGrammarForms['en'][$case][$word]) ) {
+ return $wgGrammarForms['en'][$case][$word];
+ }
return $word;
}
* for example, the preferred language variant
*
* @return string
- * @access public
+ * @public
*/
function getExtraHashOptions() {
return $this->mConverter->getExtraHashOptions();
* which should be merged onto a link of the form [[foo]]bar.
*
* @return string
- * @access public
+ * @public
*/
function linkTrail() {
return $this->getMessage( 'linktrail' );