Skip to content

Commit

Permalink
Correcting order of inflection rules in pluralize(). Places uninflect…
Browse files Browse the repository at this point in the history
…ed 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
  • Loading branch information
markstory committed May 8, 2009
1 parent 029f422 commit 109bda9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cake/libs/inflector.php
Expand Up @@ -249,16 +249,16 @@ function pluralize($word) {
$_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);
Expand Down

0 comments on commit 109bda9

Please sign in to comment.