mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-02 13:02:24 +08:00
Addded pluralization and singularization exception for currency
This commit is contained in:
@ -51,6 +51,7 @@ class BaseInflector
|
||||
'/us$/i' => 'uses',
|
||||
'/(alias)$/i' => '\1es',
|
||||
'/(ax|cris|test)is$/i' => '\1es',
|
||||
'/(currenc)y$/' => '\1ies',
|
||||
'/s$/' => 's',
|
||||
'/^$/' => '',
|
||||
'/$/' => 's',
|
||||
@ -97,6 +98,7 @@ class BaseInflector
|
||||
'/(n)ews$/i' => '\1\2ews',
|
||||
'/(n)etherlands$/i' => '\1\2etherlands',
|
||||
'/eaus$/' => 'eau',
|
||||
'/(currenc)ies$/' => '\1y',
|
||||
'/^(.*us)$/' => '\\1',
|
||||
'/s$/i' => '',
|
||||
];
|
||||
|
||||
@ -31,6 +31,7 @@ class InflectorTest extends TestCase
|
||||
'test' => 'tests',
|
||||
'car' => 'cars',
|
||||
'netherlands' => 'netherlands',
|
||||
'currency' => 'currencies',
|
||||
];
|
||||
|
||||
foreach ($testData as $testIn => $testOut) {
|
||||
@ -59,6 +60,7 @@ class InflectorTest extends TestCase
|
||||
'tests' => 'test',
|
||||
'cars' => 'car',
|
||||
'Netherlands' => 'Netherlands',
|
||||
'currencies' => 'currency',
|
||||
];
|
||||
foreach ($testData as $testIn => $testOut) {
|
||||
$this->assertEquals($testOut, Inflector::singularize($testIn));
|
||||
|
||||
Reference in New Issue
Block a user