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 | |
parent | 27cf83d177256813e2e802241085fce5dd0f3fb9 (diff) |
Update to MediaWiki 1.19.0
Diffstat (limited to 'resources/mediawiki.language')
-rw-r--r-- | resources/mediawiki.language/languages/cs.js | 2 | ||||
-rw-r--r-- | resources/mediawiki.language/languages/lt.js | 3 | ||||
-rw-r--r-- | resources/mediawiki.language/languages/mk.js | 2 | ||||
-rw-r--r-- | resources/mediawiki.language/languages/se.js | 10 | ||||
-rw-r--r-- | resources/mediawiki.language/languages/sma.js | 11 | ||||
-rw-r--r-- | resources/mediawiki.language/mediawiki.language.js | 30 |
6 files changed, 43 insertions, 15 deletions
diff --git a/resources/mediawiki.language/languages/cs.js b/resources/mediawiki.language/languages/cs.js index 0b77909d..04dda99d 100644 --- a/resources/mediawiki.language/languages/cs.js +++ b/resources/mediawiki.language/languages/cs.js @@ -7,12 +7,10 @@ mediaWiki.language.convertPlural = function( count, forms ) { switch ( count ) { case 1: return forms[0]; - break; case 2: case 3: case 4: return forms[1]; - break; default: return forms[2]; } diff --git a/resources/mediawiki.language/languages/lt.js b/resources/mediawiki.language/languages/lt.js index ee0a609b..04964aff 100644 --- a/resources/mediawiki.language/languages/lt.js +++ b/resources/mediawiki.language/languages/lt.js @@ -3,6 +3,7 @@ */ mediaWiki.language.convertPlural = function( count, forms ) { + // if the number is not mentioned in message, then use $form[0] for singular and $form[1] for plural or zero if ( forms.length == 2 ) { return count == 1 ? forms[0] : forms[1]; } @@ -11,7 +12,7 @@ mediaWiki.language.convertPlural = function( count, forms ) { return forms[0]; } if ( count % 10 >= 2 && ( count % 100 < 10 || count % 100 >= 20 ) ) { - return forms[1]; + return forms[1]; } return forms[2]; }; diff --git a/resources/mediawiki.language/languages/mk.js b/resources/mediawiki.language/languages/mk.js index 5105025c..c89bbac5 100644 --- a/resources/mediawiki.language/languages/mk.js +++ b/resources/mediawiki.language/languages/mk.js @@ -4,5 +4,5 @@ mediaWiki.language.convertPlural = function( count, forms ) { forms = mediaWiki.language.preConvertPlural( forms, 2 ); - return ( count % 10 === 1 ) ? forms[0] : forms[1]; + return ( ( count % 10 === 1 ) && ( count % 100 !== 11 ) ) ? forms[0] : forms[1]; }; diff --git a/resources/mediawiki.language/languages/se.js b/resources/mediawiki.language/languages/se.js index 51ebaf25..e1ae5b9a 100644 --- a/resources/mediawiki.language/languages/se.js +++ b/resources/mediawiki.language/languages/se.js @@ -3,15 +3,15 @@ */ mediaWiki.language.convertPlural = function( count, forms ) { - if ( count == 0 ) { - return ''; + if ( !forms || forms.length === 0 ) { + return ''; } forms = mediaWiki.language.preConvertPlural( forms, 3 ); if ( count == 1 ) { - return forms[1]; + return forms[0]; } if ( count == 2 ) { - return forms[2]; + return forms[1]; } - return '' + return forms[2]; }; diff --git a/resources/mediawiki.language/languages/sma.js b/resources/mediawiki.language/languages/sma.js index d3ccf625..8163c42c 100644 --- a/resources/mediawiki.language/languages/sma.js +++ b/resources/mediawiki.language/languages/sma.js @@ -3,12 +3,15 @@ */ mediaWiki.language.convertPlural = function( count, forms ) { - forms = mediaWiki.language.preConvertPlural( forms, 4 ); + if ( !forms || forms.length === 0 ) { + return ''; + } + forms = mediaWiki.language.preConvertPlural( forms, 3 ); if ( count == 1 ) { - return forms[1]; + return forms[0]; } if ( count == 2 ) { - return forms[2]; + return forms[1]; } - return forms[3]; + return forms[2]; }; 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 }; |