bug #18911 Fixed singular of committee (peterrehm)

This PR was submitted for the 2.3 branch but it was merged into the 2.7 branch instead (closes #18911).

Discussion
----------

Fixed singular of committee

| Q             | A
| ------------- | ---
| Branch?       | 2.3
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #18872, #18748
| License       | MIT
| Doc PR        | -

In addition to PR #18909.

Commits
-------

5661d52 Fixed singular of committee
This commit is contained in:
Fabien Potencier 2016-06-08 13:22:54 +02:00
commit 9fdb90b6c4
2 changed files with 10 additions and 6 deletions

View File

@ -24,7 +24,6 @@ class StringUtil
* @var array
*
* @see http://english-zone.com/spelling/plurals.html
* @see http://www.scribd.com/doc/3271143/List-of-100-Irregular-Plural-Nouns-in-English
*/
private static $pluralMap = array(
// First entry: plural suffix, reversed
@ -69,6 +68,15 @@ class StringUtil
// movies (movie)
array('seivom', 6, true, true, 'movie'),
// feet (foot)
array('teef', 4, true, true, 'foot'),
// geese (goose)
array('eseeg', 5, true, true, 'goose'),
// teeth (tooth)
array('hteet', 5, true, true, 'tooth'),
// news (news)
array('swen', 4, true, true, 'news'),
@ -214,11 +222,6 @@ class StringUtil
}
}
// Convert teeth to tooth, feet to foot
if (false !== ($pos = strpos($plural, 'ee')) && strlen($plural) > 3 && 'feedback' !== $plural) {
return substr_replace($plural, 'oo', $pos, 2);
}
// Assume that plural and singular is identical
return $plural;
}

View File

@ -53,6 +53,7 @@ class StringUtilTest extends \PHPUnit_Framework_TestCase
array('children', 'child'),
array('circuses', array('circus', 'circuse', 'circusis')),
array('cliffs', 'cliff'),
array('committee', 'committee'),
array('crises', array('cris', 'crise', 'crisis')),
array('criteria', array('criterion', 'criterium')),
array('cups', 'cup'),