r78678 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r78677‎ | r78678 | r78679 >
Date:15:19, 21 December 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Follow up to r78675
Modified paths:
  • /trunk/extensions/LiveTranslate/LiveTranslate.php (modified) (history)
  • /trunk/extensions/LiveTranslate/includes/ext.livetranslate.js (modified) (history)

Diff [purge]

Index: trunk/extensions/LiveTranslate/LiveTranslate.php
@@ -57,7 +57,8 @@
5858 $wgHooks['OutputPageBeforeHTML'][] = 'LiveTranslateHooks::onOutputPageBeforeHTML';
5959
6060 $egLTJSMessages = array(
61 -
 61+ 'livetranslate-button-translate',
 62+ 'livetranslate-button-translating',
6263 );
6364
6465 // For backward compatibility with MW < 1.17.
Index: trunk/extensions/LiveTranslate/includes/ext.livetranslate.js
@@ -11,6 +11,8 @@
1212
1313 var runningJobs = 0;
1414
 15+ var textAreaElement = document.createElement( 'textarea' );
 16+
1517 // Compatibility with pre-RL code.
1618 // Messages will have been loaded into wgPushMessages.
1719 if ( typeof mediaWiki === 'undefined' ) {
@@ -28,7 +30,7 @@
2931 }
3032
3133 $('#livetranslatebutton').click(function() {
32 - $( this ).attr( "disabled", true );
 34+ $( this ).attr( "disabled", true ).text( mediaWiki.msg( 'livetranslate-button-translating' ) );
3335
3436 var words = getSpecialWords();
3537 var newLang = $( '#livetranslatelang' ).val();
@@ -122,7 +124,8 @@
123125
124126 if ( chunkSize < currentMaxSize ) {
125127 // If the current chunk was smaller then the max size, node translation is complete, so update text.
126 - element.replaceWholeText( chunks.join() );
 128+ textAreaElement.innerHTML = chunks.join(); // This is a hack to decode quotes.
 129+ element.replaceData( 0, element.length, textAreaElement.value );
127130 handleTranslationCompletion( targetLang );
128131 }
129132 else {
@@ -136,7 +139,7 @@
137140 function handleTranslationCompletion( targetLang ) {
138141 if ( !--runningJobs ) {
139142 currentLang = targetLang;
140 - $( '#livetranslatebutton' ).attr( "disabled", false );
 143+ $( '#livetranslatebutton' ).attr( "disabled", false ).text( mediaWiki.msg( 'livetranslate-button-translate' ) );
141144 }
142145 }
143146

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r78675Added detection of source and destination languagejeroendedauw14:28, 21 December 2010

Status & tagging log