<?php
/**
- * @defgroup Language Language
+ * Internationalisation code
*
* @file
* @ingroup Language
*/
+/**
+ * @defgroup Language Language
+ */
+
if ( !defined( 'MEDIAWIKI' ) ) {
echo "This file is part of MediaWiki, it is not a valid entry point.\n";
exit( 1 );
class FakeConverter {
var $mLang;
function FakeConverter( $langobj ) { $this->mLang = $langobj; }
- function autoConvertToAllVariants( $text ) { return $text; }
+ function autoConvertToAllVariants( $text ) { return array( $this->mLang->getCode() => $text ); }
function convert( $t ) { return $t; }
function convertTitle( $t ) { return $t->getPrefixedText(); }
function getVariants() { return array( $this->mLang->getCode() ); }
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 convertLinkToAllVariants( $text ) { return autoConvertToAllVariants( $text ); }
function armourMath( $text ) { return $text; }
}
*/
function getNamespaces() {
if ( is_null( $this->namespaceNames ) ) {
- global $wgExtraNamespaces, $wgMetaNamespace, $wgMetaNamespaceTalk;
+ global $wgMetaNamespace, $wgMetaNamespaceTalk, $wgExtraNamespaces;
$this->namespaceNames = self::$dataCache->getItem( $this->mCode, 'namespaceNames' );
- if ( $wgExtraNamespaces ) {
- $this->namespaceNames = $wgExtraNamespaces + $this->namespaceNames;
- }
+ $validNamespaces = MWNamespace::getCanonicalNamespaces();
+
+ $this->namespaceNames = $wgExtraNamespaces + $this->namespaceNames + $validNamespaces;
$this->namespaceNames[NS_PROJECT] = $wgMetaNamespace;
if ( $wgMetaNamespaceTalk ) {
}
# Sometimes a language will be localised but not actually exist on this wiki.
- $validNamespaces = MWNamespace::getValidNamespaces();
foreach( $this->namespaceNames as $key => $text ) {
- if ( ! in_array( $key, $validNamespaces ) ) {
- unset( $this->namespaceNames[$key] );
- }
+ if ( !isset( $validNamespaces[$key] ) ) {
+ unset( $this->namespaceNames[$key] );
+ }
}
# The above mixing may leave namespaces out of canonical order.