From: Krinkle Date: Thu, 16 Jun 2011 21:20:05 +0000 (+0000) Subject: (bug 29441) Expose CapitalLinks config in JS to allow modules to properly handle... X-Git-Tag: 1.31.0-rc.0~29487 X-Git-Url: http://git.cyclocoop.org/%24action?a=commitdiff_plain;h=0e02d2f4cbbb7ebcfeda24e6c16b6792b7f7ba5e;p=lhc%2Fweb%2Fwiklou.git (bug 29441) Expose CapitalLinks config in JS to allow modules to properly handle titles on case-sensitive wikis. This brings us one step closer towards: (bug 29397) Implement mw.Title module in core --- diff --git a/includes/resourceloader/ResourceLoaderStartUpModule.php b/includes/resourceloader/ResourceLoaderStartUpModule.php index a7c15a2cca..8ce592e01c 100644 --- a/includes/resourceloader/ResourceLoaderStartUpModule.php +++ b/includes/resourceloader/ResourceLoaderStartUpModule.php @@ -55,14 +55,21 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule { ); $mainPage = Title::newMainPage(); - // Build wgNamespaceIds - // A complete key-value pair object mapping localized, canonical and aliases for namespaces - // to their numerical ids (case insensitive and with underscores) + /** + * Namespace related preparation + * - wgNamespaceIds: Key-value pairs of all localized, canonical and aliases for namespaces. + * - wgCaseSensitiveNamespaces: Array of namespaces that are case-sensitive. + */ $namespaceIds = $wgContLang->getNamespaceIds(); + $caseSensitiveNamespaces = array(); foreach( MWNamespace::getCanonicalNamespaces() as $index => $name ) { $namespaceIds[$wgContLang->lc( $name )] = $index; + if ( !MWNamespace::isCapitalized( $index ) ) { + $caseSensitiveNamespaces[] = $index; + } } + $serverBits = wfParseUrl( $wgServer ); $protocol = $serverBits ? $serverBits['scheme'] : 'http'; @@ -106,6 +113,7 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule { 'wgCookiePrefix' => $wgCookiePrefix, 'wgResourceLoaderMaxQueryLength' => $wgResourceLoaderMaxQueryLength, 'wgLegacyJavaScriptGlobals' => $wgLegacyJavaScriptGlobals, + 'wgCaseSensitiveNamespaces' => $caseSensitiveNamespaces, ); if ( $wgUseAjax && $wgEnableMWSuggest ) { $vars['wgMWSuggestTemplate'] = SearchEngine::getMWSuggestTemplate(); @@ -263,4 +271,4 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule { public function getGroup() { return 'startup'; } -} \ No newline at end of file +}