r79110 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r79109‎ | r79110 | r79111 >
Date:17:32, 28 December 2010
Author:jeroendedauw
Status:deferred (Comments)
Tags:
Comment:
Added type indications to the function docs
Modified paths:
  • /trunk/extensions/LiveTranslate/includes/ext.livetranslate.js (modified) (history)

Diff [purge]

Index: trunk/extensions/LiveTranslate/includes/ext.livetranslate.js
@@ -135,6 +135,8 @@
136136
137137 /**
138138 * Inserts notranslate spans around the words specified in the passed array in the page content.
 139+ *
 140+ * @param {Array} words
139141 */
140142 function insertNoTranslateTags( words ) {
141143 for ( i in words ) {
@@ -169,7 +171,7 @@
170172 * Replaced the special words in the page content by looping over them,
171173 * and checking if there is a matching translation in the provided object.
172174 *
173 - * @param translations
 175+ * @param {object} translations
174176 */
175177 function replaceSpecialWords( translations ) {
176178 $.each($(".notranslate"), function(i,v) {
@@ -183,8 +185,8 @@
184186 /**
185187 * Initiates the Google Translate translation.
186188 *
187 - * @param sourceLang
188 - * @param targetLang
 189+ * @param {string} sourceLang
 190+ * @param {string} targetLang
189191 */
190192 function requestGoogleTranslate( sourceLang, targetLang ) {
191193 translateElement( $( '#bodyContent' ), sourceLang, targetLang );
@@ -196,9 +198,9 @@
197199 *
198200 * TODO: be smarter with the requests, and make sure they don't get broken up unecesarrily.
199201 *
200 - * @param element
201 - * @param sourceLang
202 - * @param targetLang
 202+ * @param {jQuery} element
 203+ * @param {string} sourceLang
 204+ * @param {string} targetLang
203205 */
204206 function translateElement( element, sourceLang, targetLang ) {
205207 runningJobs++;
@@ -234,12 +236,12 @@
235237 * Determines a chunk to translate of an DOM elements contents and calls the Google Translate API.
236238 * Then calls itself if there is any remaining word to be done.
237239 *
238 - * @param untranslatedScentances
239 - * @param chunks
240 - * @param currentMaxSize
241 - * @param sourceLang
242 - * @param targetLang
243 - * @param element
 240+ * @param {array} untranslatedScentances
 241+ * @param {array} chunks
 242+ * @param {integer} currentMaxSize
 243+ * @param {string} sourceLang
 244+ * @param {string} targetLang
 245+ * @param {jQuery} element
244246 */
245247 function translateChunk( untranslatedScentances, chunks, currentMaxSize, sourceLang, targetLang, element ) {
246248 var remainingPart = false;
@@ -320,7 +322,7 @@
321323 * By use of the runningJobs var, completion of the translation process is detected,
322324 * and further handled by this function.
323325 *
324 - * @param targetLang
 326+ * @param {string} targetLang
325327 */
326328 function handleTranslationCompletion( targetLang ) {
327329 if ( !--runningJobs ) {

Comments

#Comment by Jeroen De Dauw (talk | contribs)   19:44, 28 December 2010

Yay - my 2000th commit in the WMF repo :D

Status & tagging log