Index: trunk/extensions/Lingo/Lingo.i18n.php |
— | — | @@ -9,10 +9,12 @@ |
10 | 10 | $messages = array(); |
11 | 11 | |
12 | 12 | $messages['en'] = array( |
13 | | - 'lingo-desc' => 'Provides hover-over tool tips on pages from words defined on the [[Terminology]] page' |
| 13 | + 'lingo-desc' => 'Provides hover-over tool tips on pages from words defined on the [[$1]] page', |
| 14 | + 'lingo-terminologypage' => 'Terminology' |
14 | 15 | ); |
15 | 16 | |
16 | 17 | $messages['qqq'] = array( |
17 | | - 'lingo-desc' => '{{desc}}' |
| 18 | + 'lingo-desc' => '{{desc}}', |
| 19 | + 'lingo-terminologypage' => 'Name of the page where the terms and definitions of the glossary are stored' |
18 | 20 | ); |
19 | 21 | |
Index: trunk/extensions/Lingo/Lingo.php |
— | — | @@ -19,39 +19,39 @@ |
20 | 20 | |
21 | 21 | define( 'LINGO_VERSION', '0.2 alpha' ); |
22 | 22 | |
23 | | -$wgExtensionCredits['parserhook'][] = array( |
24 | | - 'path' => __FILE__, |
25 | | - 'name' => 'Lingo', |
26 | | - 'author' => array('Barry Coughlan', '[http://www.mediawiki.org/wiki/User:F.trott Stephan Gambke]'), |
27 | | - 'url' => 'http://www.mediawiki.org/wiki/Extension:Lingo', |
28 | | - 'descriptionmsg' => 'lingo-desc', |
29 | | - 'version' => LINGO_VERSION, |
30 | | -); |
| 23 | +// set defaults for settings |
31 | 24 | |
32 | | -// server-local path to this file |
33 | | -$wgexLingoDir = dirname( __FILE__ ); |
34 | | - |
35 | 25 | // set LingoBasicBackend as the backend to access the glossary |
36 | 26 | $wgexLingoBackend = 'LingoBasicBackend'; |
37 | 27 | |
| 28 | +// set default for Terminology page (null = take from i18n) |
| 29 | +$wgexLingoPage = null; |
| 30 | + |
| 31 | + |
| 32 | +// server-local path to this file |
| 33 | +$dir = dirname( __FILE__ ); |
| 34 | + |
38 | 35 | // register message file |
39 | | -$wgExtensionMessagesFiles['Lingo'] = $wgexLingoDir . '/Lingo.i18n.php'; |
| 36 | +$wgExtensionMessagesFiles[ 'Lingo' ] = $dir . '/Lingo.i18n.php'; |
40 | 37 | // $wgExtensionMessagesFiles['LingoAlias'] = $dir . '/Lingo.alias.php'; |
41 | | - |
42 | 38 | // register class files with the Autoloader |
43 | 39 | // $wgAutoloadClasses['LingoSettings'] = $dir . '/LingoSettings.php'; |
44 | | -$wgAutoloadClasses['LingoParser'] = $wgexLingoDir . '/LingoParser.php'; |
45 | | -$wgAutoloadClasses['LingoTree'] = $wgexLingoDir . '/LingoTree.php'; |
46 | | -$wgAutoloadClasses['LingoElement'] = $wgexLingoDir . '/LingoElement.php'; |
47 | | -$wgAutoloadClasses['LingoBackend'] = $wgexLingoDir . '/LingoBackend.php'; |
48 | | -$wgAutoloadClasses['LingoBasicBackend'] = $wgexLingoDir . '/LingoBasicBackend.php'; |
49 | | -$wgAutoloadClasses['LingoMessageLog'] = $wgexLingoDir . '/LingoMessageLog.php'; |
| 40 | +$wgAutoloadClasses[ 'LingoParser' ] = $dir . '/LingoParser.php'; |
| 41 | +$wgAutoloadClasses[ 'LingoTree' ] = $dir . '/LingoTree.php'; |
| 42 | +$wgAutoloadClasses[ 'LingoElement' ] = $dir . '/LingoElement.php'; |
| 43 | +$wgAutoloadClasses[ 'LingoBackend' ] = $dir . '/LingoBackend.php'; |
| 44 | +$wgAutoloadClasses[ 'LingoBasicBackend' ] = $dir . '/LingoBasicBackend.php'; |
| 45 | +$wgAutoloadClasses[ 'LingoMessageLog' ] = $dir . '/LingoMessageLog.php'; |
50 | 46 | // $wgAutoloadClasses['SpecialLingoBrowser'] = $dir . '/SpecialLingoBrowser.php'; |
51 | 47 | |
52 | | -$wgHooks['ParserAfterTidy'][] = 'LingoParser::parse'; |
| 48 | +unset ($dir); |
53 | 49 | |
| 50 | +$wgHooks[ 'SpecialVersionExtensionTypes' ][ ] = 'fnLingoSetCredits'; |
| 51 | +//$wgExtensionFunctions[ ] = 'fnLingoInit'; |
| 52 | +$wgHooks[ 'ParserAfterTidy' ][ ] = 'LingoParser::parse'; |
| 53 | + |
54 | 54 | // register resource modules with the Resource Loader |
55 | | -$wgResourceModules['ext.Lingo'] = array( |
| 55 | +$wgResourceModules[ 'ext.Lingo' ] = array( |
56 | 56 | // JavaScript and CSS styles. To combine multiple file, just list them as an array. |
57 | 57 | // 'scripts' => 'libs/ext.myExtension.js', |
58 | 58 | 'styles' => 'skins/Lingo.css', |
— | — | @@ -69,3 +69,27 @@ |
70 | 70 | 'remoteExtPath' => 'Lingo' |
71 | 71 | ); |
72 | 72 | |
| 73 | +/** |
| 74 | + * Deferred setting of extension credits |
| 75 | + * |
| 76 | + * Setting of extension credits has to be deferred to the |
| 77 | + * SpecialVersionExtensionTypes hook as it uses variable $wgexLingoPage (which |
| 78 | + * might be set only after inclusion of the extension in LocalSettings) and |
| 79 | + * function wfMsg not available before. |
| 80 | + * |
| 81 | + * @return Boolean Always true. |
| 82 | + */ |
| 83 | +function fnLingoSetCredits() { |
| 84 | + |
| 85 | + global $wgExtensionCredits, $wgexLingoPage; |
| 86 | + $wgExtensionCredits[ 'parserhook' ][ ] = array( |
| 87 | + 'path' => __FILE__, |
| 88 | + 'name' => 'Lingo', |
| 89 | + 'author' => array( 'Barry Coughlan', '[http://www.mediawiki.org/wiki/User:F.trott Stephan Gambke]' ), |
| 90 | + 'url' => 'http://www.mediawiki.org/wiki/Extension:Lingo', |
| 91 | + 'descriptionmsg' => array('lingo-desc', $wgexLingoPage?$wgexLingoPage:wfMsg('lingo-terminologypage')), |
| 92 | + 'version' => LINGO_VERSION, |
| 93 | + ); |
| 94 | + |
| 95 | + return true; |
| 96 | +} |