mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Correcting order of inflection rules in pluralize(). Places uninflected rules before irregular rules. Fixes compatibility with non-english languages. Fixes #6351
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@8169 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
029f422953
commit
109bda97b8
1 changed files with 5 additions and 5 deletions
|
@ -249,16 +249,16 @@ class Inflector extends Object {
|
|||
$_this->pluralRules['regexIrregular'] = $regexIrregular;
|
||||
}
|
||||
|
||||
if (preg_match('/(.*)\\b(' . $regexIrregular . ')$/i', $word, $regs)) {
|
||||
$_this->pluralized[$word] = $regs[1] . substr($word, 0, 1) . substr($irregular[strtolower($regs[2])], 1);
|
||||
return $_this->pluralized[$word];
|
||||
}
|
||||
|
||||
if (preg_match('/^(' . $regexUninflected . ')$/i', $word, $regs)) {
|
||||
$_this->pluralized[$word] = $word;
|
||||
return $word;
|
||||
}
|
||||
|
||||
if (preg_match('/(.*)\\b(' . $regexIrregular . ')$/i', $word, $regs)) {
|
||||
$_this->pluralized[$word] = $regs[1] . substr($word, 0, 1) . substr($irregular[strtolower($regs[2])], 1);
|
||||
return $_this->pluralized[$word];
|
||||
}
|
||||
|
||||
foreach ($pluralRules as $rule => $replacement) {
|
||||
if (preg_match($rule, $word)) {
|
||||
$_this->pluralized[$word] = preg_replace($rule, $replacement, $word);
|
||||
|
|
Loading…
Add table
Reference in a new issue