r111735 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111734‎ | r111735 | r111736 >
Date:09:47, 17 February 2012
Author:santhosh
Status:ok
Tags:i18nreview 
Comment:
Typo fixes, code cleanup as per CR of r111646
Modified paths:
  • /branches/jsgrammar/resources/mediawiki.language/mediawiki.language.js (modified) (history)
  • /branches/jsgrammar/resources/mediawiki/mediawiki.jqueryMsg.js (modified) (history)

Diff [purge]

Index: branches/jsgrammar/resources/mediawiki/mediawiki.jqueryMsg.js
@@ -664,10 +664,10 @@
665665 return this.language.gender( gender, forms );
666666 },
667667 /**
668 - * Transform parsed structure into grammar conversion
 668+ * Transform parsed structure into grammar conversion.
669669 * Invoked by putting {{grammar:form|word}} in a message
670 - * @param {Array} of noders [{Grammar case eg: genitive}, {String word}]
671 - * @return {String} selected gender form according to current language
 670+ * @param {Array} of nodes [{Grammar case eg: genitive}, {String word}]
 671+ * @return {String} selected grammatical form according to current language
672672 */
673673 grammar: function( nodes ) {
674674 var form = nodes[0];
Index: branches/jsgrammar/resources/mediawiki.language/mediawiki.language.js
@@ -9,7 +9,7 @@
1010
1111 mw.language = {
1212 /**
13 - * @var data {Object} Langauge related data
 13+ * @var data {Object} Language related data
1414 * Keyed by language, contains instances of mw.Map
1515 * @example Set data
1616 * <code>
@@ -22,7 +22,7 @@
2323 * </code>
2424 * @example Get data
2525 * <code>
26 - * var grammerForms = mw.language.data[langCode].get( 'grammerForms' );
 26+ * var grammarForms = mw.language.data[langCode].get( 'grammarForms' );
2727 * </code>
2828 */
2929 data: {},
@@ -37,7 +37,7 @@
3838 * }
3939 * @example {{Template:title|params}}
4040 */
41 - 'procPLURAL': function( template ) {
 41+ procPLURAL: function( template ) {
4242 if ( template.title && template.parameters && mw.language.convertPlural ) {
4343 // Check if we have forms to replace
4444 if ( template.parameters.length === 0 ) {
@@ -61,7 +61,7 @@
6262 * @param forms array List of plural forms
6363 * @return string Correct form for quantifier in this language
6464 */
65 - 'convertPlural': function( count, forms ){
 65+ convertPlural: function( count, forms ){
6666 if ( !forms || forms.length === 0 ) {
6767 return '';
6868 }
@@ -74,7 +74,7 @@
7575 * @param count integer Number of forms required
7676 * @return array Padded array of forms
7777 */
78 - 'preConvertPlural': function( forms, count ) {
 78+ preConvertPlural: function( forms, count ) {
7979 while ( forms.length < count ) {
8080 forms.push( forms[ forms.length-1 ] );
8181 }
@@ -86,7 +86,7 @@
8787 * @param {num} number Value to be converted
8888 * @param {boolean} integer Convert the return value to an integer
8989 */
90 - 'convertNumber': function( num, integer ) {
 90+ convertNumber: function( num, integer ) {
9191 if ( !mw.language.digitTransformTable ) {
9292 return num;
9393 }
@@ -126,7 +126,7 @@
127127 *
128128 * @return string
129129 */
130 - 'gender': function( gender, forms ) {
 130+ gender: function( gender, forms ) {
131131 if ( !forms || forms.length === 0 ) {
132132 return '';
133133 }
@@ -140,7 +140,7 @@
141141 return ( forms.length === 3 ) ? forms[2] : forms[0];
142142 },
143143 /**
144 - * Grammatical transformations, needed for inflected languages
 144+ * Grammatical transformations, needed for inflected languages.
145145 * Invoked by putting {{grammar:form|word}} in a message
146146 * The rules can be defined in wgGrammarForms global or grammar
147147 * forms can be dynamically calculated by overriding this per language
@@ -149,14 +149,14 @@
150150 * @param form string
151151 * @return string
152152 */
153 - 'convertGrammar': function( word, form ) {
154 - var grammarForms = mw.language.data[ mw.config.get( 'wgContentLanguage' )].get( 'grammarForms' );
 153+ convertGrammar: function( word, form ) {
 154+ var grammarForms = mw.language.data[mw.config.get( 'wgContentLanguage' )].get( 'grammarForms' );
155155 if ( grammarForms && grammarForms[form] ) {
156156 return grammarForms[form][word] || word ;
157157 }
158158 return word;
159159 },
160160 // Digit Transform Table, populated by language classes where applicable
161 - 'digitTransformTable': null
 161+ digitTransformTable: null
162162 };
163163 } )( jQuery, mediaWiki );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r111646Add grammar parsing support for mw.jqueryMsg...santhosh15:57, 16 February 2012

Status & tagging log