Index: trunk/extensions/Duplicator/Duplicator.i18n.php |
— | — | @@ -7,6 +7,12 @@ |
8 | 8 | * @author Rob Church <robchur@gmail.com> |
9 | 9 | */ |
10 | 10 | |
| 11 | +/** |
| 12 | + * Get a two-dimensional array of extension messages, indexed |
| 13 | + * by language code, then message key |
| 14 | + * |
| 15 | + * @return array |
| 16 | + */ |
11 | 17 | function efDuplicatorMessages() { |
12 | 18 | $messages = array( |
13 | 19 | |
— | — | @@ -510,5 +516,25 @@ |
511 | 517 | |
512 | 518 | } |
513 | 519 | |
| 520 | +/** |
| 521 | + * Get an array of special page aliases |
| 522 | + * |
| 523 | + * @param string $lang Language code |
| 524 | + * @return array |
| 525 | + */ |
| 526 | +function efDuplicatorAliases( $lang ) { |
| 527 | + $aliases = array( |
| 528 | + |
| 529 | +/** |
| 530 | + * English |
| 531 | + */ |
| 532 | +'en' => array( |
| 533 | + 'Duplicator', |
| 534 | + 'Duplicate', |
| 535 | +), |
514 | 536 | |
515 | | - |
| 537 | + ); |
| 538 | + return isset( $aliases[$lang] ) && $lang != 'en' |
| 539 | + ? array_merge( $aliases[$lang], $aliases['en'] ) |
| 540 | + : $aliases['en']; |
| 541 | +} |
\ No newline at end of file |
Index: trunk/extensions/Duplicator/Duplicator.php |
— | — | @@ -10,6 +10,10 @@ |
11 | 11 | |
12 | 12 | if( defined( 'MEDIAWIKI' ) ) { |
13 | 13 | |
| 14 | + $wgAutoloadClasses['SpecialDuplicator'] = dirname( __FILE__ ) . '/Duplicator.page.php'; |
| 15 | + $wgSpecialPages['Duplicator'] = 'SpecialDuplicator'; |
| 16 | + $wgHooks['LangugeGetSpecialPageAliases'][] = 'efDuplicatorSetupAliases'; |
| 17 | + |
14 | 18 | $wgExtensionCredits['specialpage'][] = array( |
15 | 19 | 'name' => 'Duplicator', |
16 | 20 | 'author' => 'Rob Church', |
— | — | @@ -18,9 +22,6 @@ |
19 | 23 | ); |
20 | 24 | $wgExtensionFunctions[] = 'efDuplicator'; |
21 | 25 | |
22 | | - $wgAutoloadClasses['SpecialDuplicator'] = dirname( __FILE__ ) . '/Duplicator.page.php'; |
23 | | - $wgSpecialPages['Duplicator'] = 'SpecialDuplicator'; |
24 | | - |
25 | 26 | /** |
26 | 27 | * User permissions |
27 | 28 | */ |
— | — | @@ -42,6 +43,22 @@ |
43 | 44 | $wgHooks['SkinTemplateBuildNavUrlsNav_urlsAfterPermalink'][] = 'efDuplicatorNavigation'; |
44 | 45 | $wgHooks['MonoBookTemplateToolboxEnd'][] = 'efDuplicatorToolbox'; |
45 | 46 | } |
| 47 | + |
| 48 | + /** |
| 49 | + * Set up special page aliases |
| 50 | + * |
| 51 | + * @param array $aliases Special page aliases |
| 52 | + * @param string $lang Language code |
| 53 | + * @return bool |
| 54 | + */ |
| 55 | + function efDuplicatorSetupAliases( &$aliases, $lang ) { |
| 56 | + $ours = efDuplicatorAliases( $lang ); |
| 57 | + if( count( $ours ) > 0 ) { |
| 58 | + print_r( $ours ); |
| 59 | + $aliases['Duplicator'] = $ours; |
| 60 | + } |
| 61 | + return true; |
| 62 | + } |
46 | 63 | |
47 | 64 | /** |
48 | 65 | * Build the link to be shown in the toolbox if appropriate |