Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Wikipedia: Mediawiki-CVS

SVN: [24566] trunk/extensions/Duplicator

 

 

Wikipedia mediawiki-cvs RSS feed   Index | Next | Previous | View Threaded


robchurch at svn

Aug 3, 2007, 11:18 AM

Post #1 of 1 (398 views)
Permalink
SVN: [24566] trunk/extensions/Duplicator

Revision: 24566
Author: robchurch
Date: 2007-08-03 18:18:38 +0000 (Fri, 03 Aug 2007)

Log Message:
-----------
Support special page aliases, with correct English fallback and English aliases available regardless of language

Modified Paths:
--------------
trunk/extensions/Duplicator/Duplicator.i18n.php
trunk/extensions/Duplicator/Duplicator.php

Modified: trunk/extensions/Duplicator/Duplicator.i18n.php
===================================================================
--- trunk/extensions/Duplicator/Duplicator.i18n.php 2007-08-03 17:40:21 UTC (rev 24565)
+++ trunk/extensions/Duplicator/Duplicator.i18n.php 2007-08-03 18:18:38 UTC (rev 24566)
@@ -7,6 +7,12 @@
* @author Rob Church <robchur [at] gmail>
*/

+/**
+ * Get a two-dimensional array of extension messages, indexed
+ * by language code, then message key
+ *
+ * @return array
+ */
function efDuplicatorMessages() {
$messages = array(

@@ -510,5 +516,25 @@

}

+/**
+ * Get an array of special page aliases
+ *
+ * @param string $lang Language code
+ * @return array
+ */
+function efDuplicatorAliases( $lang ) {
+ $aliases = array(
+
+/**
+ * English
+ */
+'en' => array(
+ 'Duplicator',
+ 'Duplicate',
+),

-
+ );
+ return isset( $aliases[$lang] ) && $lang != 'en'
+ ? array_merge( $aliases[$lang], $aliases['en'] )
+ : $aliases['en'];
+}
\ No newline at end of file

Modified: trunk/extensions/Duplicator/Duplicator.php
===================================================================
--- trunk/extensions/Duplicator/Duplicator.php 2007-08-03 17:40:21 UTC (rev 24565)
+++ trunk/extensions/Duplicator/Duplicator.php 2007-08-03 18:18:38 UTC (rev 24566)
@@ -10,6 +10,10 @@

if( defined( 'MEDIAWIKI' ) ) {

+ $wgAutoloadClasses['SpecialDuplicator'] = dirname( __FILE__ ) . '/Duplicator.page.php';
+ $wgSpecialPages['Duplicator'] = 'SpecialDuplicator';
+ $wgHooks['LangugeGetSpecialPageAliases'][] = 'efDuplicatorSetupAliases';
+
$wgExtensionCredits['specialpage'][] = array(
'name' => 'Duplicator',
'author' => 'Rob Church',
@@ -18,9 +22,6 @@
);
$wgExtensionFunctions[] = 'efDuplicator';

- $wgAutoloadClasses['SpecialDuplicator'] = dirname( __FILE__ ) . '/Duplicator.page.php';
- $wgSpecialPages['Duplicator'] = 'SpecialDuplicator';
-
/**
* User permissions
*/
@@ -42,6 +43,22 @@
$wgHooks['SkinTemplateBuildNavUrlsNav_urlsAfterPermalink'][] = 'efDuplicatorNavigation';
$wgHooks['MonoBookTemplateToolboxEnd'][] = 'efDuplicatorToolbox';
}
+
+ /**
+ * Set up special page aliases
+ *
+ * @param array $aliases Special page aliases
+ * @param string $lang Language code
+ * @return bool
+ */
+ function efDuplicatorSetupAliases( &$aliases, $lang ) {
+ $ours = efDuplicatorAliases( $lang );
+ if( count( $ours ) > 0 ) {
+ print_r( $ours );
+ $aliases['Duplicator'] = $ours;
+ }
+ return true;
+ }

/**
* Build the link to be shown in the toolbox if appropriate



_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS [at] lists
http://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Wikipedia mediawiki-cvs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.