r79776 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r79775‎ | r79776 | r79777 >
Date:23:46, 6 January 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
fixed spelling error
Modified paths:
  • /trunk/extensions/LiveTranslate/includes/ext.livetranslate.js (modified) (history)

Diff [purge]

Index: trunk/extensions/LiveTranslate/includes/ext.livetranslate.js
@@ -236,29 +236,29 @@
237237 * Determines a chunk to translate of an DOM elements contents and calls the Google Translate API.
238238 * Then calls itself if there is any remaining word to be done.
239239 *
240 - * @param {array} untranslatedScentances
 240+ * @param {array} untranslatedsentences
241241 * @param {array} chunks
242242 * @param {integer} currentMaxSize
243243 * @param {string} sourceLang
244244 * @param {string} targetLang
245245 * @param {jQuery} element
246246 */
247 - function translateChunk( untranslatedScentances, chunks, currentMaxSize, sourceLang, targetLang, element ) {
 247+ function translateChunk( untranslatedsentences, chunks, currentMaxSize, sourceLang, targetLang, element ) {
248248 var remainingPart = false;
249249 var partToUse = false;
250 - var scentanceCount = 0;
 250+ var sentenceCount = 0;
251251 var currentLength = 0;
252252
253 - for ( i in untranslatedScentances ) {
254 - scentanceCount++;
 253+ for ( i in untranslatedsentences ) {
 254+ sentenceCount++;
255255
256 - if ( currentLength + untranslatedScentances[i].length < currentMaxSize ) {
257 - currentLength += untranslatedScentances[i].length;
 256+ if ( currentLength + untranslatedsentences[i].length < currentMaxSize ) {
 257+ currentLength += untranslatedsentences[i].length;
258258 }
259 - else if ( untranslatedScentances[i].length > 0 ) {
 259+ else if ( untranslatedsentences[i].length > 0 ) {
260260 if ( currentLength == 0 ) {
261 - partToUse = untranslatedScentances[i].substr( 0, currentMaxSize - currentLength );
262 - remainingPart = untranslatedScentances[i].substr( currentMaxSize - currentLength );
 261+ partToUse = untranslatedsentences[i].substr( 0, currentMaxSize - currentLength );
 262+ remainingPart = untranslatedsentences[i].substr( currentMaxSize - currentLength );
263263 }
264264
265265 break;
@@ -267,16 +267,16 @@
268268
269269 var chunk = '';
270270
271 - for ( i = 0; i < scentanceCount; i++ ) {
272 - var part = untranslatedScentances.shift();
 271+ for ( i = 0; i < sentenceCount; i++ ) {
 272+ var part = untranslatedsentences.shift();
273273
274 - if ( i != scentanceCount - 1 || partToUse === false ) {
 274+ if ( i != sentenceCount - 1 || partToUse === false ) {
275275 chunk += part;
276276 }
277277 }
278278
279279 if ( remainingPart !== false ) {
280 - untranslatedScentances.unshift( remainingPart );
 280+ untranslatedsentences.unshift( remainingPart );
281281 }
282282
283283 if ( partToUse !== false ) {
@@ -304,7 +304,7 @@
305305 chunks.push( chunk );
306306 }
307307
308 - if ( untranslatedScentances.length == 0 ) {
 308+ if ( untranslatedsentences.length == 0 ) {
309309 // If the current chunk was smaller then the max size, node translation is complete, so update text.
310310 textAreaElement.innerHTML = chunks.join(); // This is a hack to decode quotes.
311311 element.replaceData( 0, element.length, textAreaElement.value );
@@ -312,7 +312,7 @@
313313 }
314314 else {
315315 // If there is more work to do, move on to the next chunk.
316 - translateChunk( untranslatedScentances, chunks, currentMaxSize, sourceLang, targetLang, element );
 316+ translateChunk( untranslatedsentences, chunks, currentMaxSize, sourceLang, targetLang, element );
317317 }
318318 }
319319 );

Status & tagging log