bug #18909 Fixed singular of committee (peterrehm)
This PR was squashed before being merged into the 3.1 branch (closes #18909).
Discussion
----------
Fixed singular of committee
| Q | A
| ------------- | ---
| Branch? | 3.1?
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #18872, #18748
| License | MIT
| Doc PR | -
As in SF 3.1 the StringUtil has been moved to a new Component, I am proposing this for 3.1.
I can easily provide the same in an additional PR against the 2.3? branch.
Commits
-------
b5e1f24
Fixed singular of committee
This commit is contained in:
commit
c87c175ad5
@ -26,7 +26,6 @@ final class Inflector
|
|||||||
* @var array
|
* @var array
|
||||||
*
|
*
|
||||||
* @see http://english-zone.com/spelling/plurals.html
|
* @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(
|
private static $pluralMap = array(
|
||||||
// First entry: plural suffix, reversed
|
// First entry: plural suffix, reversed
|
||||||
@ -71,6 +70,15 @@ final class Inflector
|
|||||||
// movies (movie)
|
// movies (movie)
|
||||||
array('seivom', 6, true, true, '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)
|
// news (news)
|
||||||
array('swen', 4, true, true, 'news'),
|
array('swen', 4, true, true, 'news'),
|
||||||
|
|
||||||
@ -218,11 +226,6 @@ final class Inflector
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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
|
// Assume that plural and singular is identical
|
||||||
return $plural;
|
return $plural;
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,7 @@ class InflectorTest extends \PHPUnit_Framework_TestCase
|
|||||||
array('children', 'child'),
|
array('children', 'child'),
|
||||||
array('circuses', array('circus', 'circuse', 'circusis')),
|
array('circuses', array('circus', 'circuse', 'circusis')),
|
||||||
array('cliffs', 'cliff'),
|
array('cliffs', 'cliff'),
|
||||||
|
array('committee', 'committee'),
|
||||||
array('crises', array('cris', 'crise', 'crisis')),
|
array('crises', array('cris', 'crise', 'crisis')),
|
||||||
array('criteria', array('criterion', 'criterium')),
|
array('criteria', array('criterion', 'criterium')),
|
||||||
array('cups', 'cup'),
|
array('cups', 'cup'),
|
||||||
|
Reference in New Issue
Block a user