r54814 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r54813‎ | r54814 | r54815 >
Date:21:41, 11 August 2009
Author:siebrand
Status:deferred
Tags:
Comment:
* new style magic words support for CategoryTests
* rename description message
* add localisation support for messages and magic in Translate
* bump version
Modified paths:
  • /trunk/extensions/CategoryTests/CategoryTests.i18n.magic.php (modified) (history)
  • /trunk/extensions/CategoryTests/CategoryTests.i18n.php (modified) (history)
  • /trunk/extensions/CategoryTests/CategoryTests.php (modified) (history)
  • /trunk/extensions/Translate/groups/mediawiki-defines.txt (modified) (history)

Diff [purge]

Index: trunk/extensions/CategoryTests/CategoryTests.i18n.magic.php
@@ -3,22 +3,15 @@
44 * Magic word localization for the CategoryTests extension
55 */
66
7 -$words = array();
 7+$magicWords = array();
88
99 /** English
1010 * @author Ryan Schmidt
1111 */
12 -$words['en'] = array(
 12+$magicWords['en'] = array(
1313 'ifcategory' => array( 0, 'ifcategory' ),
1414 'ifnocategories' => array( 0, 'ifnocategories' ),
1515 'switchcategory' => array( 0, 'switchcategory' ),
1616 'default' => array( 0, '#default' ),
1717 'page' => array( 0, '#page' )
1818 );
19 -
20 -/**
21 - * Note for non-English translations
22 - * Unlike the English one above where the array has two values, all translations must have THREE values, like so:
23 - * 'ifcategory' => array( 0, 'translation_goes_here', 'ifcategory' )
24 - * The third value should be the same as the name of the key string you are translating for
25 - */
Index: trunk/extensions/CategoryTests/CategoryTests.i18n.php
@@ -3,11 +3,13 @@
44 * Internationalization file for the CategoryTests extension
55 */
66
 7+require_once( dirname(__FILE__) . '/CategoryTests.i18n.magic.php' );
 8+
79 $messages = array();
810
911 /** English
1012 * @author Ryan Schmidt
1113 */
1214 $messages['en'] = array(
13 - 'categorytests' => 'Functions for category testing'
 15+ 'categorytests-desc' => 'Functions for category testing'
1416 );
Index: trunk/extensions/CategoryTests/CategoryTests.php
@@ -15,14 +15,13 @@
1616 $wgExtensionCredits['parserhook'][] = array(
1717 'path' => __FILE__,
1818 'name' => 'Category Tests',
19 - 'version' => '1.2',
 19+ 'version' => '1.3',
2020 'url' => 'http://www.mediawiki.org/wiki/Extension:CategoryTests',
2121 'author' => 'Ryan Schmidt',
2222 'description' => 'Functions for category testing',
23 - 'descriptionmsg' => 'categorytests',
 23+ 'descriptionmsg' => 'categorytests-desc',
2424 );
2525
26 -$wgHooks['LanguageGetMagic'][] = 'wfCategoryTestsLanguageGetMagic';
2726 $wgExtensionMessagesFiles['CategoryTests'] = dirname( __FILE__ ) . '/CategoryTests.i18n.php';
2827
2928 function wfCategoryTests() {
@@ -34,19 +33,6 @@
3534 $wgParser->setFunctionHook( 'switchcategory', array( &$wgExtCategoryTests, 'switchcategory' ) );
3635 }
3736
38 -function wfCategoryTestsLanguageGetMagic( &$magicWords, $langCode ) {
39 - require_once( dirname( __FILE__ ) . '/CategoryTests.i18n.magic.php' );
40 - if ( $langCode == 'en' || !array_key_exists( $langCode, $words ) ) {
41 - $functions = $words['en'];
42 - } else {
43 - $functions = array_merge( $words[$langCode], $words['en'] );
44 - }
45 - foreach ( $functions as $key => $value ) {
46 - $magicWords[$key] = $value;
47 - }
48 - return true;
49 -}
50 -
5137 Class ExtCategoryTests {
5238
5339 function ifcategory( &$parser, $category = '', $then = '', $else = '', $pagename = '' ) {
Index: trunk/extensions/Translate/groups/mediawiki-defines.txt
@@ -94,6 +94,9 @@
9595 Category Stepper
9696 ignored = categorystepper
9797
 98+Category Tests
 99+magicfile = CategoryTests/CategoryTests.i18n.magic.php
 100+
98101 Category Tree
99102 aliasfile = CategoryTree/CategoryTree.alias.php
100103 ignored = categorytree-collapse-bullet, categorytree-expand-bullet,

Status & tagging log