* @return string
*/
function convertPlural( $count, $forms ) {
+ $forms = $this->handleExplicitPluralForms( $count, $forms );
+ if ( is_string( $forms ) ) {
+ return $forms;
+ }
if ( !count( $forms ) ) {
return '';
}
'qbedit' => 'Edit',
'qbpageoptions' => 'This page',
'qbmyoptions' => 'My pages',
-'qbspecialpages' => 'Special pages',
'faq' => 'FAQ',
'faqpage' => 'Project:FAQ',
'sitetitle' => '{{SITENAME}}', # do not translate or duplicate this message to other languages
'perfcachedts' => 'The following data is cached, and was last updated $1. A maximum of {{PLURAL:$4|one result is|$4 results are}} available in the cache.',
'querypage-no-updates' => 'Updates for this page are currently disabled.
Data here will not presently be refreshed.',
-'wrong_wfQuery_params' => 'Incorrect parameters to wfQuery()<br />
-Function: $1<br />
-Query: $2',
'viewsource' => 'View source',
'viewsource-title' => 'View source for $1',
'actionthrottled' => 'Action throttled',
'qbedit',
'qbpageoptions',
'qbmyoptions',
- 'qbspecialpages',
'faq',
'faqpage',
'sitetitle',
'perfcached',
'perfcachedts',
'querypage-no-updates',
- 'wrong_wfQuery_params',
'viewsource',
'viewsource-title',
'actionthrottled',
$this->assertEquals( $result, $this->getLang()->convertPlural( $value, $forms ) );
}
+ /**
+ * Test explicit plural forms - n=FormN forms
+ * @covers Language::convertPlural
+ */
+ public function testExplicitPlural() {
+ $forms = array( 'one', 'few', 'many', 'other', '12=dozen' );
+ $this->assertEquals( 'dozen', $this->getLang()->convertPlural( 12, $forms ) );
+ $forms = array( 'one', 'few', 'many', '100=hundred', 'other', '12=dozen' );
+ $this->assertEquals( 'hundred', $this->getLang()->convertPlural( 100, $forms ) );
+ }
+
/**
* @dataProvider providePlural
* @covers Language::getPluralRuleType