r37055 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r37054‎ | r37055 | r37056 >
Date:14:32, 4 July 2008
Author:nikerabbit
Status:old
Tags:
Comment:
* 2008-07-04:2
- use a existing hook for quick links
- possible fix for Windows
Modified paths:
  • /trunk/extensions/Translate/README (modified) (history)
  • /trunk/extensions/Translate/Translate.php (modified) (history)
  • /trunk/extensions/Translate/TranslateEditAddons.php (modified) (history)
  • /trunk/extensions/Translate/groups/MediaWikiExtensions.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/groups/MediaWikiExtensions.php
@@ -8,12 +8,15 @@
99
1010 $dir = dirname( __FILE__ );
1111 $defines = file_get_contents( $dir . '/mediawiki-defines.txt' );
12 - $sections = array_map( 'trim', preg_split( "/\n\n+/", $defines, -1, PREG_SPLIT_NO_EMPTY ) );
1312
 13+ $linefeed = '(\r\n|\n)';
 14+
 15+ $sections = array_map( 'trim', preg_split( "/$linefeed{2,}/", $defines, -1, PREG_SPLIT_NO_EMPTY ) );
 16+
1417 $groups = $fixedGroups = array();
1518
1619 foreach ( $sections as $section ) {
17 - $lines = array_map( 'trim', preg_split( "/\n/", $section ) );
 20+ $lines = array_map( 'trim', preg_split( "/$linefeed/", $section ) );
1821 $newgroup = array();
1922
2023 foreach ( $lines as $line ) {
Index: trunk/extensions/Translate/TranslateEditAddons.php
@@ -11,12 +11,12 @@
1212 class TranslateEditAddons {
1313 const MSG = 'translate-edit-';
1414
15 - static function addNavigation( &$article, &$out ) {
16 - global $wgTranslateMessageNamespaces, $wgUser;
17 - $ns = $article->mTitle->getNamespace();
 15+ static function addNavigation( &$outputpage, &$text ) {
 16+ global $wgTranslateMessageNamespaces, $wgUser, $wgTitle;
 17+ $ns = $wgTitle->getNamespace();
1818 if( !in_array($ns, $wgTranslateMessageNamespaces) ) return true;
1919
20 - list( $key, $code ) = self::figureMessage( $article );
 20+ list( $key, $code ) = self::figureMessage( $wgTitle);
2121
2222 $group = self::getMessageGroup( $ns, $key );
2323 if ( $group === null ) return true;
@@ -62,14 +62,14 @@
6363 wfMsgHtml( 'translate-edit-goto-list' ),
6464 "group=$id&language=$code#msg_$next" );
6565
66 - $out->addHTML(
 66+ $text .=
6767 "<hr />
6868 <ul>
6969 <li>$prevLink</li>
7070 <li>$nextLink</li>
7171 <li>$list</li>
7272 </ul><hr />
73 -<pre>$def</pre>" );
 73+<pre>$def</pre>";
7474
7575 return true;
7676 }
@@ -133,9 +133,9 @@
134134 /**
135135 * @return Array of the message and the language
136136 */
137 - private static function figureMessage( $object ) {
 137+ private static function figureMessage( $title ) {
138138 global $wgContLanguageCode, $wgContLang;
139 - $pieces = explode('/', $wgContLang->lcfirst($object->mTitle->getDBkey()), 3);
 139+ $pieces = explode('/', $wgContLang->lcfirst($title->getDBkey()), 3);
140140
141141 $key = $pieces[0];
142142
@@ -172,7 +172,7 @@
173173 wfLoadExtensionMessages( 'Translate' );
174174 global $wgTranslateDocumentationLanguageCode, $wgOut;
175175
176 - list( $key, $code ) = self::figureMessage( $object );
 176+ list( $key, $code ) = self::figureMessage( $object->mTitle );
177177
178178 $group = self::getMessageGroup( $object->mTitle->getNamespace(), $key );
179179 if ( $group === null ) return;
Index: trunk/extensions/Translate/Translate.php
@@ -11,7 +11,7 @@
1212 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
1313 */
1414
15 -define( 'TRANSLATE_VERSION', '9 (2008-07-04:1)' );
 15+define( 'TRANSLATE_VERSION', '9 (2008-07-04:2)' );
1616
1717 $wgExtensionCredits['specialpage'][] = array(
1818 'name' => 'Translate',
@@ -35,8 +35,7 @@
3636 $wgSpecialPageGroups['TranslationChanges'] = 'changes';
3737
3838 $wgHooks['EditPage::showEditForm:initial'][] = 'TranslateEditAddons::addTools';
39 -// TODO: Use either a committed hook or commit this
40 -$wgHooks['ArticleAfterView'][] = 'TranslateEditAddons::addNavigation';
 39+$wgHooks['OutputPageBeforeHTML'][] = 'TranslateEditAddons::addNavigation';
4140 $wgHooks['UserToggles'][] = 'TranslatePreferences::TranslateUserToggles';
4241 $wgHooks['SpecialRecentChangesQuery'][] = 'TranslateRcFilter::translationFilter';
4342 $wgHooks['SpecialRecentChangesPanel'][] = 'TranslateRcFilter::translationFilterForm';
Index: trunk/extensions/Translate/README
@@ -34,6 +34,9 @@
3535
3636 == Changes in version 10 ==
3737
 38+* 2008-07-04:2
 39+ - use a existing hook for quick links
 40+ - possible fix for Windows
3841 * 2008-07-04:1 poimport uses correct namespace
3942 * 2008-07-01:1
4043 - Fix gettext message name snippets: filter / and trim after trailing

Status & tagging log