diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2012-05-03 13:01:35 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2012-05-03 13:01:35 +0200 |
commit | d9022f63880ce039446fba8364f68e656b7bf4cb (patch) | |
tree | 16b40fbf17bf7c9ee6f4ead25b16dd192378050a /resources/mediawiki.language/mediawiki.language.js | |
parent | 27cf83d177256813e2e802241085fce5dd0f3fb9 (diff) |
Update to MediaWiki 1.19.0
Diffstat (limited to 'resources/mediawiki.language/mediawiki.language.js')
-rw-r--r-- | resources/mediawiki.language/mediawiki.language.js | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/resources/mediawiki.language/mediawiki.language.js b/resources/mediawiki.language/mediawiki.language.js index fa7aa8d5..4abfa4ba 100644 --- a/resources/mediawiki.language/mediawiki.language.js +++ b/resources/mediawiki.language/mediawiki.language.js @@ -22,7 +22,7 @@ mw.language = { 'procPLURAL': function( template ) { if ( template.title && template.parameters && mw.language.convertPlural ) { // Check if we have forms to replace - if ( template.parameters.length == 0 ) { + if ( template.parameters.length === 0 ) { return ''; } // Restore the count into a Number ( if it got converted earlier ) @@ -44,7 +44,7 @@ mw.language = { * @return string Correct form for quantifier in this language */ 'convertPlural': function( count, forms ){ - if ( !forms || forms.length == 0 ) { + if ( !forms || forms.length === 0 ) { return ''; } return ( parseInt( count, 10 ) == 1 ) ? forms[0] : forms[1]; @@ -96,6 +96,32 @@ mw.language = { } return integer ? parseInt( convertedNumber, 10 ) : convertedNumber; }, + /** + * Provides an alternative text depending on specified gender. + * Usage {{gender:[gender|user object]|masculine|feminine|neutral}}. + * If second or third parameter are not specified, masculine is used. + * + * These details may be overriden per language. + * + * @param gender string male, female, or anything else for neutral. + * @param forms array List of gender forms + * + * @return string + */ + 'gender': function( gender, forms ) { + if ( !forms || forms.length === 0 ) { + return ''; + } + forms = mw.language.preConvertPlural( forms, 2 ); + if ( gender === 'male' ) { + return forms[0]; + } + if ( gender === 'female' ) { + return forms[1]; + } + return ( forms.length === 3 ) ? forms[2] : forms[0]; + }, + // Digit Transform Table, populated by language classes where applicable 'digitTransformTable': null }; |