mLang = $langobj;} function convert($t, $i) {return $t;} function parserConvert($t, $p) {return $t;} function getVariants() { return array( $this->mLang->getCode() ); } function getPreferredVariant() {return $this->mLang->getCode(); } function findVariantLink(&$l, &$n, $ignoreOtherCond = false) {} function getExtraHashOptions() {return '';} function getParsedTitle() {return '';} function markNoConversion($text, $noParse=false) {return $text;} function convertCategoryKey( $key ) {return $key; } function convertLinkToAllVariants($text){ return array( $this->mLang->getCode() => $text); } function armourMath($text){ return $text; } } /** * Internationalisation code * @ingroup Language */ class Language { var $mConverter, $mVariants, $mCode, $mLoaded = false; var $mMagicExtensions = array(), $mMagicHookDone = false; static public $mLocalisationKeys = array( 'fallback', 'namespaceNames', 'mathNames', 'bookstoreList', 'magicWords', 'messages', 'rtl', 'digitTransformTable', 'separatorTransformTable', 'fallback8bitEncoding', 'linkPrefixExtension', 'defaultUserOptionOverrides', 'linkTrail', 'namespaceAliases', 'dateFormats', 'datePreferences', 'datePreferenceMigrationMap', 'defaultDateFormat', 'extraUserToggles', 'specialPageAliases', 'imageFiles' ); static public $mMergeableMapKeys = array( 'messages', 'namespaceNames', 'mathNames', 'dateFormats', 'defaultUserOptionOverrides', 'magicWords', 'imageFiles' ); static public $mMergeableListKeys = array( 'extraUserToggles' ); static public $mMergeableAliasListKeys = array( 'specialPageAliases' ); static public $mLocalisationCache = array(); static public $mLangObjCache = array(); static public $mWeekdayMsgs = array( 'sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday' ); static public $mWeekdayAbbrevMsgs = array( 'sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat' ); static public $mMonthMsgs = array( 'january', 'february', 'march', 'april', 'may_long', 'june', 'july', 'august', 'september', 'october', 'november', 'december' ); static public $mMonthGenMsgs = array( 'january-gen', 'february-gen', 'march-gen', 'april-gen', 'may-gen', 'june-gen', 'july-gen', 'august-gen', 'september-gen', 'october-gen', 'november-gen', 'december-gen' ); static public $mMonthAbbrevMsgs = array( 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec' ); static public $mIranianCalendarMonthMsgs = array( 'iranian-calendar-m1', 'iranian-calendar-m2', 'iranian-calendar-m3', 'iranian-calendar-m4', 'iranian-calendar-m5', 'iranian-calendar-m6', 'iranian-calendar-m7', 'iranian-calendar-m8', 'iranian-calendar-m9', 'iranian-calendar-m10', 'iranian-calendar-m11', 'iranian-calendar-m12' ); static public $mHebrewCalendarMonthMsgs = array( 'hebrew-calendar-m1', 'hebrew-calendar-m2', 'hebrew-calendar-m3', 'hebrew-calendar-m4', 'hebrew-calendar-m5', 'hebrew-calendar-m6', 'hebrew-calendar-m7', 'hebrew-calendar-m8', 'hebrew-calendar-m9', 'hebrew-calendar-m10', 'hebrew-calendar-m11', 'hebrew-calendar-m12', 'hebrew-calendar-m6a', 'hebrew-calendar-m6b' ); static public $mHebrewCalendarMonthGenMsgs = array( 'hebrew-calendar-m1-gen', 'hebrew-calendar-m2-gen', 'hebrew-calendar-m3-gen', 'hebrew-calendar-m4-gen', 'hebrew-calendar-m5-gen', 'hebrew-calendar-m6-gen', 'hebrew-calendar-m7-gen', 'hebrew-calendar-m8-gen', 'hebrew-calendar-m9-gen', 'hebrew-calendar-m10-gen', 'hebrew-calendar-m11-gen', 'hebrew-calendar-m12-gen', 'hebrew-calendar-m6a-gen', 'hebrew-calendar-m6b-gen' ); static public $mHijriCalendarMonthMsgs = array( 'hijri-calendar-m1', 'hijri-calendar-m2', 'hijri-calendar-m3', 'hijri-calendar-m4', 'hijri-calendar-m5', 'hijri-calendar-m6', 'hijri-calendar-m7', 'hijri-calendar-m8', 'hijri-calendar-m9', 'hijri-calendar-m10', 'hijri-calendar-m11', 'hijri-calendar-m12' ); /** * Get a cached language object for a given language code */ static function factory( $code ) { if ( !isset( self::$mLangObjCache[$code] ) ) { if( count( self::$mLangObjCache ) > 10 ) { // Don't keep a billion objects around, that's stupid. self::$mLangObjCache = array(); } self::$mLangObjCache[$code] = self::newFromCode( $code ); } return self::$mLangObjCache[$code]; } /** * Create a language object for a given language code */ protected static function newFromCode( $code ) { global $IP; static $recursionLevel = 0; if ( $code == 'en' ) { $class = 'Language'; } else { $class = 'Language' . str_replace( '-', '_', ucfirst( $code ) ); // Preload base classes to work around APC/PHP5 bug if ( file_exists( "$IP/languages/classes/$class.deps.php" ) ) { include_once("$IP/languages/classes/$class.deps.php"); } if ( file_exists( "$IP/languages/classes/$class.php" ) ) { include_once("$IP/languages/classes/$class.php"); } } if ( $recursionLevel > 5 ) { throw new MWException( "Language fallback loop detected when creating class $class\n" ); } if( ! class_exists( $class ) ) { $fallback = Language::getFallbackFor( $code ); ++$recursionLevel; $lang = Language::newFromCode( $fallback ); --$recursionLevel; $lang->setCode( $code ); } else { $lang = new $class; } return $lang; } function __construct() { $this->mConverter = new FakeConverter($this); // Set the code to the name of the descendant if ( get_class( $this ) == 'Language' ) { $this->mCode = 'en'; } else { $this->mCode = str_replace( '_', '-', strtolower( substr( get_class( $this ), 8 ) ) ); } } /** * Reduce memory usage */ function __destruct() { foreach ( $this as $name => $value ) { unset( $this->$name ); } } /** * Hook which will be called if this is the content language. * Descendants can use this to register hook functions or modify globals */ function initContLang() {} /** * @deprecated Use User::getDefaultOptions() * @return array */ function getDefaultUserOptions() { wfDeprecated( __METHOD__ ); return User::getDefaultOptions(); } function getFallbackLanguageCode() { return self::getFallbackFor( $this->mCode ); } /** * Exports $wgBookstoreListEn * @return array */ function getBookstoreList() { $this->load(); return $this->bookstoreList; } /** * @return array */ function getNamespaces() { $this->load(); return $this->namespaceNames; } /** * A convenience function that returns the same thing as * getNamespaces() except with the array values changed to ' ' * where it found '_', useful for producing output to be displayed * e.g. in