-function wfAddCustomMagicWordLang( &$magicWords, $langCode ) {
- switch ( $langCode ) {
- case 'es':
- $magicWords[MAG_CUSTOM] = array( 0, "#aduanero", "#custom" );
- break;
- default:
- $magicWords[MAG_CUSTOM] = array( 0, "#custom" );
- }
+And to add a new parser function:
+
+Create a file called ExtensionName.i18n.magic.php with the following contents:
+----
+<?php
+
+$magicWords = array();
+
+$magicWords['en'] = array(
+ // Case insensitive.
+ 'mag_custom' => array( 0, 'custom' ),
+);
+
+$magicWords['es'] = array(
+ 'mag_custom' => array( 0, 'aduanero' ),
+);
+----
+
+$wgExtensionMessagesFiles['ExtensionNameMagic'] = dirname( __FILE__ ) . '/ExtensionName.i18n.magic.php';
+$wgHooks['ParserFirstCallInit'][] = 'wfRegisterCustomMagicWord';
+
+function wfRegisterCustomMagicWord( &$parser ){
+ $parser->setFunctionHook( 'mag_custom', 'wfGetCustomMagicWordValue' );