Index: trunk/extensions/LiveTranslate/includes/ext.livetranslate.js |
— | — | @@ -236,29 +236,29 @@ |
237 | 237 | * Determines a chunk to translate of an DOM elements contents and calls the Google Translate API. |
238 | 238 | * Then calls itself if there is any remaining word to be done. |
239 | 239 | * |
240 | | - * @param {array} untranslatedScentances |
| 240 | + * @param {array} untranslatedsentences |
241 | 241 | * @param {array} chunks |
242 | 242 | * @param {integer} currentMaxSize |
243 | 243 | * @param {string} sourceLang |
244 | 244 | * @param {string} targetLang |
245 | 245 | * @param {jQuery} element |
246 | 246 | */ |
247 | | - function translateChunk( untranslatedScentances, chunks, currentMaxSize, sourceLang, targetLang, element ) { |
| 247 | + function translateChunk( untranslatedsentences, chunks, currentMaxSize, sourceLang, targetLang, element ) { |
248 | 248 | var remainingPart = false; |
249 | 249 | var partToUse = false; |
250 | | - var scentanceCount = 0; |
| 250 | + var sentenceCount = 0; |
251 | 251 | var currentLength = 0; |
252 | 252 | |
253 | | - for ( i in untranslatedScentances ) { |
254 | | - scentanceCount++; |
| 253 | + for ( i in untranslatedsentences ) { |
| 254 | + sentenceCount++; |
255 | 255 | |
256 | | - if ( currentLength + untranslatedScentances[i].length < currentMaxSize ) { |
257 | | - currentLength += untranslatedScentances[i].length; |
| 256 | + if ( currentLength + untranslatedsentences[i].length < currentMaxSize ) { |
| 257 | + currentLength += untranslatedsentences[i].length; |
258 | 258 | } |
259 | | - else if ( untranslatedScentances[i].length > 0 ) { |
| 259 | + else if ( untranslatedsentences[i].length > 0 ) { |
260 | 260 | 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 ); |
263 | 263 | } |
264 | 264 | |
265 | 265 | break; |
— | — | @@ -267,16 +267,16 @@ |
268 | 268 | |
269 | 269 | var chunk = ''; |
270 | 270 | |
271 | | - for ( i = 0; i < scentanceCount; i++ ) { |
272 | | - var part = untranslatedScentances.shift(); |
| 271 | + for ( i = 0; i < sentenceCount; i++ ) { |
| 272 | + var part = untranslatedsentences.shift(); |
273 | 273 | |
274 | | - if ( i != scentanceCount - 1 || partToUse === false ) { |
| 274 | + if ( i != sentenceCount - 1 || partToUse === false ) { |
275 | 275 | chunk += part; |
276 | 276 | } |
277 | 277 | } |
278 | 278 | |
279 | 279 | if ( remainingPart !== false ) { |
280 | | - untranslatedScentances.unshift( remainingPart ); |
| 280 | + untranslatedsentences.unshift( remainingPart ); |
281 | 281 | } |
282 | 282 | |
283 | 283 | if ( partToUse !== false ) { |
— | — | @@ -304,7 +304,7 @@ |
305 | 305 | chunks.push( chunk ); |
306 | 306 | } |
307 | 307 | |
308 | | - if ( untranslatedScentances.length == 0 ) { |
| 308 | + if ( untranslatedsentences.length == 0 ) { |
309 | 309 | // If the current chunk was smaller then the max size, node translation is complete, so update text. |
310 | 310 | textAreaElement.innerHTML = chunks.join(); // This is a hack to decode quotes. |
311 | 311 | element.replaceData( 0, element.length, textAreaElement.value ); |
— | — | @@ -312,7 +312,7 @@ |
313 | 313 | } |
314 | 314 | else { |
315 | 315 | // 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 ); |
317 | 317 | } |
318 | 318 | } |
319 | 319 | ); |