Index: trunk/phase3/includes/parser/CoreParserFunctions.php |
— | — | @@ -76,7 +76,6 @@ |
77 | 77 | $parser->setFunctionHook( 'revisionuser', array( __CLASS__, 'revisionuser' ), SFH_NO_HASH ); |
78 | 78 | $parser->setFunctionHook( 'tag', array( __CLASS__, 'tagObj' ), SFH_OBJECT_ARGS ); |
79 | 79 | $parser->setFunctionHook( 'formatdate', array( __CLASS__, 'formatDate' ) ); |
80 | | - $parser->setFunctionHook( 'groupconvert', array( __CLASS__, 'groupconvert' ), SFH_NO_HASH ); |
81 | 80 | |
82 | 81 | if ( $wgAllowDisplayTitle ) { |
83 | 82 | $parser->setFunctionHook( 'displaytitle', array( __CLASS__, 'displaytitle' ), SFH_NO_HASH ); |
— | — | @@ -113,7 +112,7 @@ |
114 | 113 | $date = $df->reformat( $pref, $date, array('match-whole') ); |
115 | 114 | return $date; |
116 | 115 | } |
117 | | - |
| 116 | + |
118 | 117 | static function ns( $parser, $part1 = '' ) { |
119 | 118 | global $wgContLang; |
120 | 119 | if ( intval( $part1 ) || $part1 == "0" ) { |
— | — | @@ -738,12 +737,4 @@ |
739 | 738 | ); |
740 | 739 | return $parser->extensionSubstitution( $params, $frame ); |
741 | 740 | } |
742 | | - |
743 | | - /** |
744 | | - * magic word call for a group convert from LanguageConverter. |
745 | | - */ |
746 | | - public static function groupconvert( $parser, $group ) { |
747 | | - global $wgContLang; |
748 | | - return $wgContLang->groupConvert( $group ); |
749 | | - } |
750 | 741 | } |
Index: trunk/phase3/languages/LanguageConverter.php |
— | — | @@ -34,7 +34,6 @@ |
35 | 35 | var $mFlags; |
36 | 36 | var $mDescCodeSep = ':',$mDescVarSep = ';'; |
37 | 37 | var $mUcfirst = false; |
38 | | - var $mGroups = array(); |
39 | 38 | |
40 | 39 | const CACHE_VERSION_KEY = 'VERSION 6'; |
41 | 40 | |
— | — | @@ -436,7 +435,7 @@ |
437 | 436 | |
438 | 437 | /* don't do anything if this is the conversion table */ |
439 | 438 | if ( $parser->getTitle()->getNamespace() == NS_MEDIAWIKI && |
440 | | - strpos($parser->mTitle->getText(), 'onversiontable') !== false ) |
| 439 | + strpos($parser->mTitle->getText(), "Conversiontable") !== false ) |
441 | 440 | { |
442 | 441 | return $text; |
443 | 442 | } |
— | — | @@ -685,7 +684,7 @@ |
686 | 685 | * load conversion tables either from the cache or the disk |
687 | 686 | * @private |
688 | 687 | */ |
689 | | - function loadTables( $fromcache = true ) { |
| 688 | + function loadTables($fromcache=true) { |
690 | 689 | global $wgMemc; |
691 | 690 | if( $this->mTablesLoaded ) |
692 | 691 | return; |
— | — | @@ -703,14 +702,9 @@ |
704 | 703 | // we will first load the default tables |
705 | 704 | // then update them using things in MediaWiki:Zhconversiontable/* |
706 | 705 | $this->loadDefaultTables(); |
707 | | - foreach( $this->mVariants as $var ) { |
708 | | - $cached = $this->parseCachedTable( $var ); |
709 | | - // load group convert table, e.g. [[MediaWiki:Groupconversiontable-StarTrek]]. |
710 | | - foreach( $this->mGroups as $group ) { |
711 | | - $cachedgroup = $this->parseCachedTable( $var, '', true, "Groupconversiontable-$group" ); |
712 | | - $cached = array_merge( $cached, $cachedgroup ); |
713 | | - } |
714 | | - $this->mTables[$var]->mergeArray( $cached ); |
| 706 | + foreach($this->mVariants as $var) { |
| 707 | + $cached = $this->parseCachedTable($var); |
| 708 | + $this->mTables[$var]->mergeArray($cached); |
715 | 709 | } |
716 | 710 | |
717 | 711 | $this->postLoadTables(); |
— | — | @@ -758,24 +752,24 @@ |
759 | 753 | * and will be parsed recursively if $recursive=true |
760 | 754 | * |
761 | 755 | */ |
762 | | - function parseCachedTable($code, $subpage='', $recursive=true, $table='Conversiontable') { |
| 756 | + function parseCachedTable($code, $subpage='', $recursive=true) { |
763 | 757 | global $wgMessageCache; |
764 | 758 | static $parsed = array(); |
765 | 759 | |
766 | 760 | if(!is_object($wgMessageCache)) |
767 | 761 | return array(); |
768 | 762 | |
769 | | - $key = "$table/".$code; |
| 763 | + $key = 'Conversiontable/'.$code; |
770 | 764 | if($subpage) |
771 | 765 | $key .= '/' . $subpage; |
772 | 766 | |
773 | 767 | if(array_key_exists($key, $parsed)) |
774 | 768 | return array(); |
775 | | - |
| 769 | + |
776 | 770 | if ( strpos( $code, '/' ) === false ) { |
777 | | - $txt = $wgMessageCache->get( $table, true, $code ); |
| 771 | + $txt = $wgMessageCache->get( 'Conversiontable', true, $code ); |
778 | 772 | } else { |
779 | | - $title = Title::makeTitleSafe( NS_MEDIAWIKI, "$table/$code" ); |
| 773 | + $title = Title::makeTitleSafe( NS_MEDIAWIKI, "Conversiontable/$code" ); |
780 | 774 | if ( $title && $title->exists() ) { |
781 | 775 | $article = new Article( $title ); |
782 | 776 | $txt = $article->getContents(); |
— | — | @@ -783,9 +777,10 @@ |
784 | 778 | $txt = ''; |
785 | 779 | } |
786 | 780 | } |
| 781 | + |
787 | 782 | // get all subpage links of the form |
788 | 783 | // [[MediaWiki:conversiontable/zh-xx/...|...]] |
789 | | - $linkhead = $this->mLangObj->getNsText(NS_MEDIAWIKI) . ":$table"; |
| 784 | + $linkhead = $this->mLangObj->getNsText(NS_MEDIAWIKI) . ':Conversiontable'; |
790 | 785 | $subs = explode('[[', $txt); |
791 | 786 | $sublinks = array(); |
792 | 787 | foreach( $subs as $sub ) { |
— | — | @@ -804,6 +799,7 @@ |
805 | 800 | } |
806 | 801 | } |
807 | 802 | |
| 803 | + |
808 | 804 | // parse the mappings in this page |
809 | 805 | $blocks = explode($this->mMarkup['begin'], $txt); |
810 | 806 | array_shift($blocks); |
— | — | @@ -897,17 +893,6 @@ |
898 | 894 | $ret = $this->mMarkup['begin'] . 'R|' . $text . $this->mMarkup['end']; |
899 | 895 | return $ret; |
900 | 896 | } |
901 | | - |
902 | | - /** |
903 | | - * Callback function for magicword 'groupconvert' |
904 | | - * |
905 | | - * @param string $group: the group name called for |
906 | | - * @return blank string |
907 | | - */ |
908 | | - function groupConvert( $group ) { |
909 | | - $this->mGroups[] = $group; |
910 | | - return ''; |
911 | | - } |
912 | 897 | } |
913 | 898 | |
914 | 899 | /** |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -344,7 +344,6 @@ |
345 | 345 | 'staticredirect' => array( 1, '__STATICREDIRECT__' ), |
346 | 346 | 'protectionlevel' => array( 1, 'PROTECTIONLEVEL' ), |
347 | 347 | 'formatdate' => array( 0, 'formatdate', 'dateformat' ), |
348 | | - 'groupconvert' => array( 0, 'GROUPCONVERT:', 'GC:' ), |
349 | 348 | ); |
350 | 349 | |
351 | 350 | /** |
Index: trunk/phase3/languages/Language.php |
— | — | @@ -47,7 +47,6 @@ |
48 | 48 | function convertCategoryKey( $key ) {return $key; } |
49 | 49 | function convertLinkToAllVariants($text){ return array( $this->mLang->getCode() => $text); } |
50 | 50 | function armourMath($text){ return $text; } |
51 | | - function groupConvert($group) {return '';} |
52 | 51 | } |
53 | 52 | |
54 | 53 | /** |
— | — | @@ -2358,16 +2357,6 @@ |
2359 | 2358 | function markNoConversion( $text, $noParse=false ) { |
2360 | 2359 | return $this->mConverter->markNoConversion( $text, $noParse ); |
2361 | 2360 | } |
2362 | | - |
2363 | | - /** |
2364 | | - * Callback function for magicword 'groupconvert' |
2365 | | - * |
2366 | | - * @param string $group: the group name called for |
2367 | | - * @return blank string |
2368 | | - */ |
2369 | | - function groupConvert( $group ) { |
2370 | | - return $this->mConverter->groupConvert( $group ); |
2371 | | - } |
2372 | 2361 | |
2373 | 2362 | /** |
2374 | 2363 | * A regular expression to match legal word-trailing characters |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -46,9 +46,6 @@ |
47 | 47 | * Add CSS defintion of the 'wikitable' class to shared.css |
48 | 48 | * (bug 17163) Added MediaWiki:Talkpageheader which will be displayed when |
49 | 49 | viewing talk pages |
50 | | -* Add group convertsion support for LanguageConverter. New magic word |
51 | | - "{{GROUPCONVERT:xxx}}" enabled for this new feature. You can set related |
52 | | - conversion rules in [[MediaWiki:Groupconversiontable-xxx/language_code]]. |
53 | 50 | * Superfluous border="0" removed from images |
54 | 51 | * Added new hook 'MessageCacheReplace' into MessageCache.php. For instance |
55 | 52 | to allow extensions to update caches in similar way as MediaWiki invalidates |