Index: trunk/extensions/Translate/TranslateEditAddons.php |
— | — | @@ -409,8 +409,23 @@ |
410 | 410 | } |
411 | 411 | |
412 | 412 | public static function customDisplay( $article, &$content ) { |
413 | | - if ( self::isMessageNamespace( $article->getTitle() ) ) { |
414 | | - $content = "<pre><nowiki>$content</nowiki></pre>"; |
| 413 | + global $wgRequest, $wgTitle; |
| 414 | + if ( |
| 415 | + $wgRequest->getVal( 'action' ) !== 'edit' && |
| 416 | + $article->getTitle()->equals( $wgTitle ) && |
| 417 | + self::isMessageNamespace( $article->getTitle() ) ) |
| 418 | + { |
| 419 | + list( $key, $code, $group ) = self::getKeyCodeGroup( $article->getTitle() ); |
| 420 | + $def = $group->getMessage( $key, 'en' ); |
| 421 | + $content = TranslateUtils::convertWhiteSpaceToHTML( $content ); |
| 422 | + $deftext = wfMsgNoTrans( 'translate-edit-show-def' ); |
| 423 | + $trans = wfMsgNoTrans( 'translate-edit-show-trans' ); |
| 424 | + $content = <<<HTML |
| 425 | +<table class=wikitable> |
| 426 | + <tr><th>$deftext</th><th>$trans</th></tr> |
| 427 | + <tr><td><nowiki>$def</nowiki></td><td><nowiki>$content</nowiki></td></tr> |
| 428 | +</table> |
| 429 | +HTML; |
415 | 430 | } |
416 | 431 | return true; |
417 | 432 | } |
Index: trunk/extensions/Translate/Translate.php |
— | — | @@ -90,6 +90,7 @@ |
91 | 91 | $wgHooks['EditPageBeforeEditButtons'][] = 'TranslateEditAddons::buttonHack'; |
92 | 92 | $wgHooks['EditPage::showEditForm:fields'][] = 'TranslateEditAddons::keepFields'; |
93 | 93 | $wgHooks['SkinTemplateTabs'][] = 'TranslateEditAddons::tabs'; |
| 94 | +$wgHooks['ArticleAfterFetchContent'][] = 'TranslateEditAddons::customDisplay'; |
94 | 95 | |
95 | 96 | // Custom preferences |
96 | 97 | $wgDefaultUserOptions['translate'] = 0; |
— | — | @@ -670,4 +671,4 @@ |
671 | 672 | $wgNamespacesToBeSearchedDefault[$id] = true; |
672 | 673 | } |
673 | 674 | |
674 | | -/** @defgroup TranslateSpecialPage Special pages of Translate extension */ |
| 675 | +/** @defgroup TranslateSpecialPage Special pages of Translate extension */ |
\ No newline at end of file |
Index: trunk/extensions/Translate/Translate.i18n.php |
— | — | @@ -85,8 +85,11 @@ |
86 | 86 | |
87 | 87 | 'translate-edit-tab-prev' => '<<<', |
88 | 88 | 'translate-edit-tab-next' => '>>>', |
89 | | - 'translate-edit-tab-list' => 'Message list', |
| 89 | + 'translate-edit-tab-list' => 'Message list', |
90 | 90 | |
| 91 | + 'translate-edit-show-def' => 'Message definition', |
| 92 | + 'translate-edit-show-trans' => 'Translation', |
| 93 | + |
91 | 94 | 'translate-magic-pagename' => 'Extended MediaWiki translation', |
92 | 95 | 'translate-magic-help' => 'You can translate special pages aliases, magic words and namespace names. |
93 | 96 | |