From 109bda97b8d8f4440c88c98d586b4b91f9b86c8d Mon Sep 17 00:00:00 2001 From: mark_story Date: Fri, 8 May 2009 03:17:26 +0000 Subject: [PATCH] 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 --- cake/libs/inflector.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cake/libs/inflector.php b/cake/libs/inflector.php index 3dc5b2fc5..badf3d519 100644 --- a/cake/libs/inflector.php +++ b/cake/libs/inflector.php @@ -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);