r102678 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r102677‎ | r102678 | r102679 >
Date:19:55, 10 November 2011
Author:nikerabbit
Status:deferred
Tags:
Comment:
Use lqt way of registering namespace - this way localisation cache doesn't bork
Modified paths:
  • /trunk/extensions/Maps/Maps.hooks.php (modified) (history)
  • /trunk/extensions/Maps/Maps.i18n.namespaces.php (added) (history)
  • /trunk/extensions/Maps/Maps.i18n.php (modified) (history)
  • /trunk/extensions/Maps/Maps.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Maps/Maps.i18n.namespaces.php
@@ -0,0 +1,14 @@
 2+<?php
 3+
 4+$namespaceNames = array();
 5+
 6+// For wikis without LiquidThreads installed.
 7+if ( ! defined('Maps_NS_LAYER') ) {
 8+ define( 'Maps_NS_LAYER', 420 );
 9+ define( 'Maps_NS_LAYER_TALK', 421 );
 10+}
 11+
 12+$namespaceNames['en'] = array(
 13+ Maps_NS_LAYER => 'Layer',
 14+ Maps_NS_LAYER_TALK => 'Layer_talk',
 15+);
Property changes on: trunk/extensions/Maps/Maps.i18n.namespaces.php
___________________________________________________________________
Added: svn:eol-style
116 + native
Index: trunk/extensions/Maps/Maps.i18n.php
@@ -24,6 +24,7 @@
2525 'maps-load-failed' => 'Could not load the map!',
2626 'maps-markers' => 'Markers',
2727 'maps-others' => 'others',
 28+ //TODO: move to namespaces i18n
2829 'maps-ns-layer' => 'Layer',
2930 'maps-ns-layer-talk' => 'Layer talk',
3031 'maps-layer-property' => 'Property',
Index: trunk/extensions/Maps/Maps.php
@@ -141,8 +141,8 @@
142142 $wgAPIModules['geocode'] = 'ApiGeocode';
143143
144144 $wgExtensionMessagesFiles['MapsMagic'] = $egMapsDir . 'Maps.i18n.magic.php';
145 -
146145 $wgExtensionMessagesFiles['Maps'] = $egMapsDir . 'Maps.i18n.php';
 146+$wgExtensionMessagesFiles['MapsNamespaces'] = $egMapsDir . 'Maps.i18n.namespaces.php';
147147
148148 // Register the initialization function of Maps.
149149 $wgExtensionFunctions[] = 'efMapsSetup';
@@ -159,6 +159,9 @@
160160 // Since 1.0
161161 $wgHooks['MakeGlobalVariablesScript'][] = 'MapsHooks::onMakeGlobalVariablesScript';
162162
 163+// Since ??
 164+$wgHooks['CanonicalNamespaces'][] = 'MapsHooks::onCanonicalNamespaces';
 165+
163166 $egMapsFeatures = array();
164167
165168 $egMapsFeatures['pf'][] = 'MapsDisplayMap::initialize';
@@ -291,22 +294,6 @@
292295 * @return true
293296 */
294297 function efMapsSetup() {
295 - global $wgExtraNamespaces, $wgNamespaceAliases;
296 -
297 - if ( is_null( $wgExtraNamespaces ) ) {
298 - $wgExtraNamespaces = array();
299 - }
300 -
301 - $wgExtraNamespaces += array(
302 - Maps_NS_LAYER => 'Layer',
303 - Maps_NS_LAYER_TALK => 'Layer talk'
304 - );
305 -
306 - $wgNamespaceAliases += array(
307 - wfMsg( 'maps-ns-layer' ) => Maps_NS_LAYER,
308 - wfMsg( 'maps-ns-layer-talk' ) => Maps_NS_LAYER_TALK
309 - );
310 -
311298 wfRunHooks( 'MappingServiceLoad' );
312299 wfRunHooks( 'MappingFeatureLoad' );
313300
Index: trunk/extensions/Maps/Maps.hooks.php
@@ -84,4 +84,10 @@
8585 return true;
8686 }
8787
 88+
 89+ public static function onCanonicalNamespaces( &$list ) {
 90+ $list[Maps_NS_LAYER] = 'Layer';
 91+ $list[Maps_NS_LAYER_TALK] = 'Layer_talk';
 92+ return true;
 93+ }
8894 }