r76140 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r76139‎ | r76140 | r76141 >
Date:21:08, 5 November 2010
Author:nikerabbit
Status:ok
Tags:
Comment:
Some nice eye-candy and functionality for testing
Modified paths:
  • /trunk/extensions/Translate/Translate.i18n.php (modified) (history)
  • /trunk/extensions/Translate/TranslateEditAddons.php (modified) (history)
  • /trunk/extensions/Translate/js/translationdisplay.js (added) (history)

Diff [purge]

Index: trunk/extensions/Translate/js/translationdisplay.js
@@ -0,0 +1,14 @@
 2+$(document).ready( function() {
 3+ $(".translationdisplay").hover(
 4+ function() { $(this).addClass("translationdisplay-hover"); },
 5+ function() { $(this).removeClass("translationdisplay-hover"); }
 6+ );
 7+ $("#tt1").click( function() {
 8+ $("#tt1").hide();
 9+ $("#tt2").show();
 10+ });
 11+ $("#tt2").click( function() {
 12+ $("#tt2").hide();
 13+ $("#tt1").show();
 14+ });
 15+});
Property changes on: trunk/extensions/Translate/js/translationdisplay.js
___________________________________________________________________
Added: svn:eol-style
116 + native
Index: trunk/extensions/Translate/TranslateEditAddons.php
@@ -417,16 +417,28 @@
418418 {
419419 list( $key, $code, $group ) = self::getKeyCodeGroup( $article->getTitle() );
420420 if ( !$group ) return true;
421 - $def = $group->getMessage( $key, 'en' );
 421+
 422+ global $wgOut;
 423+ $wgOut->addScriptFile( TranslateUtils::assetPath( 'js/translationdisplay.js' ) );
 424+
 425+ $def = self::preserveWhitespaces( $group->getMessage( $key, 'en' ) );
422426 $content = self::preserveWhitespaces( $content );
423 - $def = self::preserveWhitespaces( $def );
 427+
424428 $deftext = wfMsgNoTrans( 'translate-edit-show-def' );
425429 $trans = wfMsgNoTrans( 'translate-edit-show-trans' );
 430+ $click = htmlspecialchars( wfMsgNoTrans( 'translate-edit-show-click' ) );
 431+
426432 $content = <<<HTML
427 -<table class=wikitable>
 433+<table class="wikitable translationdisplay" id=tt1 title="$click">
428434 <tr><th>$deftext</th><th>$trans</th></tr>
429435 <tr><td style=vertical-align:top>$def</td><td style=vertical-align:top>$content</td></tr>
430436 </table>
 437+<table class="wikitable translationdisplay" id=tt2 title="$click" style=display:none>
 438+ <tr><th>$deftext</th></tr>
 439+ <tr><td style=vertical-align:top>$def</td></tr>
 440+ <tr><th>$trans</th></tr>
 441+ <tr><td style=vertical-align:top>$content</td></tr>
 442+</table>
431443 HTML;
432444 }
433445 return true;
Index: trunk/extensions/Translate/Translate.i18n.php
@@ -89,6 +89,7 @@
9090
9191 'translate-edit-show-def' => 'Message definition',
9292 'translate-edit-show-trans' => 'Translation',
 93+ 'translate-edit-show-click' => 'Click to switch layout',
9394
9495 'translate-magic-pagename' => 'Extended MediaWiki translation',
9596 'translate-magic-help' => 'You can translate special pages aliases, magic words and namespace names.

Status & tagging log