Ori.livneh has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/76622


Change subject: Register namespace in hook handler; add docs re: customization
......................................................................

Register namespace in hook handler; add docs re: customization

Change-Id: I660368c52d063932f4f23065ce544f18df5357a0
---
M BookManagerv2.php
1 file changed, 13 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/BookManagerv2 
refs/changes/22/76622/1

diff --git a/BookManagerv2.php b/BookManagerv2.php
index 1c91151..67fa8a4 100644
--- a/BookManagerv2.php
+++ b/BookManagerv2.php
@@ -39,9 +39,6 @@
 
 define( 'NS_BOOK', 240 );
 define( 'NS_BOOK_TALK', 241 );
-
-$wgExtraNamespaces[ NS_BOOK ] = 'Book';
-$wgExtraNamespaces[ NS_BOOK_TALK ] = 'Book_talk';
 $wgContentHandlers[ 'JsonBook' ] = 'JsonBookContentHandler';
 
 // Configuration
@@ -119,6 +116,19 @@
        'JsonSchema' => __DIR__ . '/includes/JsonSchema.i18n.php'
 );
 
+// Declare namespace. If the namespace name has been localized, the
+// localized name will be used. If you'd like to override the default
+// and specify a custom namespace name for your wiki, you may do so
+// by adding these two lines to LocalSettings.php, immediately below
+// the code that loads the extension:
+//   $wgExtraNamespaces[NS_BOOK] = 'YourCustomName';
+//   $wgExtraNamespaces[NS_BOOK_TALK] = 'YourCustomName_talk';
+$wgHooks['CanonicalNamespaces'][] = function( array &$namespaces ) {
+       $namespaces[NS_BOOK] = 'Book';
+       $namespaces[NS_BOOK_TALK] = 'Book_talk';
+       return true;
+};
+
 // Register hooks
 $wgHooks['BeforePageDisplay'][] = 'BookManagerv2Hooks::onBeforePageDisplay';
 $wgHooks['EditFilterMerged'][] = 'BookManagerv2Hooks::onEditFilterMerged';

-- 
To view, visit https://gerrit.wikimedia.org/r/76622
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I660368c52d063932f4f23065ce544f18df5357a0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/BookManagerv2
Gerrit-Branch: master
Gerrit-Owner: Ori.livneh <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to