diff --git a/Vote.i18n.php b/Vote.i18n.php index 5f50b36..ed1cf18 100644 --- a/Vote.i18n.php +++ b/Vote.i18n.php @@ -13,6 +13,7 @@ $messages = array(); * @author David Pean */ $messages['en'] = array( + 'voteny-desc' => 'JavaScript-based voting with the <vote> tag', 'vote-link' => 'Vote', 'vote-unvote-link' => 'unvote', 'vote-community-score' => 'community score: $1', diff --git a/Vote.php b/Vote.php index 52893cf..1b672e7 100644 --- a/Vote.php +++ b/Vote.php @@ -23,9 +23,9 @@ if ( !defined( 'MEDIAWIKI' ) ) { // Extension credits that show up on Special:Version $wgExtensionCredits['parserhook'][] = array( 'name' => 'Vote', - 'version' => '2.4', + 'version' => '2.5', 'author' => array( 'Aaron Wright', 'David Pean', 'Jack Phoenix' ), - 'description' => 'JavaScript-based voting with the <vote> tag', + 'descriptionmsg' => 'voteny-desc', 'url' => 'https://www.mediawiki.org/wiki/Extension:VoteNY' ); @@ -43,6 +43,7 @@ require_once( 'Vote_AjaxFunctions.php' ); // Autoload classes and set up i18n $dir = dirname( __FILE__ ) . '/'; $wgExtensionMessagesFiles['Vote'] = $dir . 'Vote.i18n.php'; +$wgExtensionMessagesFiles['VoteNYMagic'] = $dir . 'VoteNY.i18n.magic.php'; $wgAutoloadClasses['Vote'] = $dir . 'VoteClass.php'; $wgAutoloadClasses['VoteStars'] = $dir . 'VoteClass.php'; @@ -56,9 +57,6 @@ $wgAutoloadClasses['VoteHooks'] = $dir . 'VoteHooks.php'; $wgHooks['ParserFirstCallInit'][] = 'VoteHooks::registerParserHook'; $wgHooks['RenameUserSQL'][] = 'VoteHooks::onUserRename'; -// Translations for {{NUMBEROFVOTES}} -//$wgExtensionMessagesFiles['NumberOfVotes'] = $dir . 'Vote.i18n.magic.php'; -$wgHooks['LanguageGetMagic'][] = 'VoteHooks::setUpMagicWord'; $wgHooks['ParserGetVariableValueSwitch'][] = 'VoteHooks::assignValueToMagicWord'; $wgHooks['MagicWordwgVariableIDs'][] = 'VoteHooks::registerVariableId'; $wgHooks['LoadExtensionSchemaUpdates'][] = 'VoteHooks::addTable'; diff --git a/VoteHooks.php b/VoteHooks.php index fd93b62..7c9526a 100644 --- a/VoteHooks.php +++ b/VoteHooks.php @@ -81,21 +81,6 @@ class VoteHooks { return true; } - /** - * Set up the {{NUMBEROFVOTES}} magic word. - * - * @param $magicWords Array: array of magic words - * @param $langID - * @return Boolean: true - */ - public static function setUpMagicWord( &$magicWords, $langID ) { - // tell MediaWiki that {{NUMBEROFVOTES}} and all case variants found in - // wiki text should be mapped to magic ID 'NUMBEROFVOTES' - // (0 means case-insensitive) - $magicWords['NUMBEROFVOTES'] = array( 0, 'NUMBEROFVOTES' ); - return true; - } - /** * Assign a value to {{NUMBEROFVOTES}}. First we try memcached and if that * fails, we fetch it directly from the database and cache it for 24 hours. diff --git a/VoteNY.i18n.magic.php b/VoteNY.i18n.magic.php new file mode 100644 index 0000000..fca243c --- /dev/null +++ b/VoteNY.i18n.magic.php @@ -0,0 +1,10 @@ + array( 0, 'NUMBEROFVOTES' ), +);