From c1f977cd459eb9997484d577de307c741305f0d4 Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Tue, 1 Oct 2013 22:57:08 -0400 Subject: [PATCH] Simplified the default file map for PhpMessageSource. --- framework/yii/i18n/PhpMessageSource.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/framework/yii/i18n/PhpMessageSource.php b/framework/yii/i18n/PhpMessageSource.php index f62939f..1cd2103 100644 --- a/framework/yii/i18n/PhpMessageSource.php +++ b/framework/yii/i18n/PhpMessageSource.php @@ -26,6 +26,8 @@ use Yii; * ); * ~~~ * + * You may use [[fileMap]] to customize the association between category names and the file names. + * * @author Qiang Xue * @since 2.0 */ @@ -60,10 +62,8 @@ class PhpMessageSource extends MessageSource $messageFile = Yii::getAlias($this->basePath) . "/$language/"; if (isset($this->fileMap[$category])) { $messageFile .= $this->fileMap[$category]; - } elseif (($pos = strrpos($category, '\\')) !== false) { - $messageFile .= (substr($category, $pos) . '.php'); } else { - $messageFile .= "$category.php"; + $messageFile .= str_replace('\\', '/', $category) . '.php'; } if (is_file($messageFile)) { $messages = include($messageFile);