Merge "mediawiki.ui: Remove deployment hack"
[lhc/web/wiklou.git] / resources / src / mediawiki.language / mediawiki.language.js
index a0b5569..2e84858 100644 (file)
@@ -144,8 +144,28 @@ $.extend( mw.language, {
                        return grammarForms[form][word] || word;
                }
                return word;
-       }
+       },
 
+       /**
+        * Turn a list of string into a simple list using commas and 'and'.
+        *
+        * See Language::listToText in languages/Language.php
+        *
+        * @param {string[]} list
+        * @return {string}
+        */
+       listToText: function ( list ) {
+               var text = '', i = 0;
+               for ( ; i < list.length; i++ ) {
+                       text += list[i];
+                       if ( list.length - 2 === i ) {
+                               text += mw.msg( 'and' ) + mw.msg( 'word-separator' );
+                       } else if ( list.length - 1 !== i ) {
+                               text += mw.msg( 'comma-separator' );
+                       }
+               }
+               return text;
+       }
 } );
 
 }( mediaWiki, jQuery ) );