From 3c1452e84b769d2fecddc07cafdcdae869dab1ee Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Tue, 5 Feb 2013 11:48:35 -0500 Subject: [PATCH] Changed the separator of message category. --- framework/base/Controller.php | 2 +- framework/base/Exception.php | 2 +- framework/base/HttpException.php | 2 +- framework/base/InvalidCallException.php | 2 +- framework/base/InvalidConfigException.php | 2 +- framework/base/InvalidRequestException.php | 2 +- framework/base/InvalidRouteException.php | 2 +- framework/base/NotSupportedException.php | 2 +- framework/base/SecurityManager.php | 8 ++++---- framework/base/UnknownMethodException.php | 2 +- framework/base/UnknownPropertyException.php | 2 +- framework/base/UrlManager.php | 6 +++--- framework/console/Application.php | 4 ++-- framework/console/Controller.php | 4 ++-- framework/console/Exception.php | 2 +- framework/console/controllers/HelpController.php | 4 ++-- framework/db/Exception.php | 2 +- framework/i18n/I18N.php | 2 +- framework/logging/EmailTarget.php | 2 +- framework/logging/ProfileTarget.php | 6 +++--- framework/validators/BooleanValidator.php | 4 ++-- framework/validators/CaptchaValidator.php | 4 ++-- framework/validators/CompareValidator.php | 24 +++++++++++----------- framework/validators/DateValidator.php | 2 +- framework/validators/EmailValidator.php | 4 ++-- framework/validators/ExistValidator.php | 2 +- framework/validators/FileValidator.php | 18 ++++++++-------- framework/validators/NumberValidator.php | 16 +++++++-------- framework/validators/RangeValidator.php | 6 +++--- .../validators/RegularExpressionValidator.php | 4 ++-- framework/validators/RequiredValidator.php | 8 ++++---- framework/validators/StringValidator.php | 14 ++++++------- framework/validators/UniqueValidator.php | 2 +- framework/validators/UrlValidator.php | 4 ++-- framework/web/AssetManager.php | 4 ++-- framework/web/Controller.php | 2 +- framework/web/Request.php | 2 +- framework/web/Session.php | 8 ++++---- 38 files changed, 94 insertions(+), 94 deletions(-) diff --git a/framework/base/Controller.php b/framework/base/Controller.php index 15681e8..58deda2 100644 --- a/framework/base/Controller.php +++ b/framework/base/Controller.php @@ -177,7 +177,7 @@ class Controller extends Component } if ($missing !== array()) { - throw new InvalidRequestException(Yii::t('yii:Missing required parameters: {params}', array( + throw new InvalidRequestException(Yii::t('yii|Missing required parameters: {params}', array( '{params}' => implode(', ', $missing), ))); } diff --git a/framework/base/Exception.php b/framework/base/Exception.php index d9cb77a..0088a55 100644 --- a/framework/base/Exception.php +++ b/framework/base/Exception.php @@ -22,7 +22,7 @@ class Exception extends \Exception */ public function getName() { - return \Yii::t('yii:Exception'); + return \Yii::t('yii|Exception'); } } diff --git a/framework/base/HttpException.php b/framework/base/HttpException.php index e23ff09..a839b06 100644 --- a/framework/base/HttpException.php +++ b/framework/base/HttpException.php @@ -104,6 +104,6 @@ class HttpException extends UserException if(isset($httpCodes[$this->statusCode])) return $httpCodes[$this->statusCode]; else - return \Yii::t('yii:Error'); + return \Yii::t('yii|Error'); } } diff --git a/framework/base/InvalidCallException.php b/framework/base/InvalidCallException.php index ab9de67..cdd5c6b 100644 --- a/framework/base/InvalidCallException.php +++ b/framework/base/InvalidCallException.php @@ -22,7 +22,7 @@ class InvalidCallException extends Exception */ public function getName() { - return \Yii::t('yii:Invalid Call'); + return \Yii::t('yii|Invalid Call'); } } diff --git a/framework/base/InvalidConfigException.php b/framework/base/InvalidConfigException.php index 97cdc8e..683b2f4 100644 --- a/framework/base/InvalidConfigException.php +++ b/framework/base/InvalidConfigException.php @@ -22,7 +22,7 @@ class InvalidConfigException extends Exception */ public function getName() { - return \Yii::t('yii:Invalid Configuration'); + return \Yii::t('yii|Invalid Configuration'); } } diff --git a/framework/base/InvalidRequestException.php b/framework/base/InvalidRequestException.php index 428d008..377abbd 100644 --- a/framework/base/InvalidRequestException.php +++ b/framework/base/InvalidRequestException.php @@ -22,7 +22,7 @@ class InvalidRequestException extends UserException */ public function getName() { - return \Yii::t('yii:Invalid Request'); + return \Yii::t('yii|Invalid Request'); } } diff --git a/framework/base/InvalidRouteException.php b/framework/base/InvalidRouteException.php index 929221c..74216c5 100644 --- a/framework/base/InvalidRouteException.php +++ b/framework/base/InvalidRouteException.php @@ -22,7 +22,7 @@ class InvalidRouteException extends UserException */ public function getName() { - return \Yii::t('yii:Invalid Route'); + return \Yii::t('yii|Invalid Route'); } } diff --git a/framework/base/NotSupportedException.php b/framework/base/NotSupportedException.php index b7efed4..f487069 100644 --- a/framework/base/NotSupportedException.php +++ b/framework/base/NotSupportedException.php @@ -22,7 +22,7 @@ class NotSupportedException extends Exception */ public function getName() { - return \Yii::t('yii:Not Supported'); + return \Yii::t('yii|Not Supported'); } } diff --git a/framework/base/SecurityManager.php b/framework/base/SecurityManager.php index 04be15c..a3fb654 100644 --- a/framework/base/SecurityManager.php +++ b/framework/base/SecurityManager.php @@ -79,7 +79,7 @@ class SecurityManager extends Component if (!empty($value)) { $this->_validationKey = $value; } else { - throw new CException(Yii::t('yii:SecurityManager.validationKey cannot be empty.')); + throw new CException(Yii::t('yii|SecurityManager.validationKey cannot be empty.')); } } @@ -112,7 +112,7 @@ class SecurityManager extends Component if (!empty($value)) { $this->_encryptionKey = $value; } else { - throw new CException(Yii::t('yii:SecurityManager.encryptionKey cannot be empty.')); + throw new CException(Yii::t('yii|SecurityManager.encryptionKey cannot be empty.')); } } @@ -191,12 +191,12 @@ class SecurityManager extends Component } if ($module === false) { - throw new CException(Yii::t('yii:Failed to initialize the mcrypt module.')); + throw new CException(Yii::t('yii|Failed to initialize the mcrypt module.')); } return $module; } else { - throw new CException(Yii::t('yii:SecurityManager requires PHP mcrypt extension to be loaded in order to use data encryption feature.')); + throw new CException(Yii::t('yii|SecurityManager requires PHP mcrypt extension to be loaded in order to use data encryption feature.')); } } diff --git a/framework/base/UnknownMethodException.php b/framework/base/UnknownMethodException.php index 0cad676..b46903f 100644 --- a/framework/base/UnknownMethodException.php +++ b/framework/base/UnknownMethodException.php @@ -22,7 +22,7 @@ class UnknownMethodException extends Exception */ public function getName() { - return \Yii::t('yii:Unknown Method'); + return \Yii::t('yii|Unknown Method'); } } diff --git a/framework/base/UnknownPropertyException.php b/framework/base/UnknownPropertyException.php index a226f84..4cb768d 100644 --- a/framework/base/UnknownPropertyException.php +++ b/framework/base/UnknownPropertyException.php @@ -22,7 +22,7 @@ class UnknownPropertyException extends Exception */ public function getName() { - return \Yii::t('yii:Unknown Property'); + return \Yii::t('yii|Unknown Property'); } } diff --git a/framework/base/UrlManager.php b/framework/base/UrlManager.php index e90f08f..db6b598 100644 --- a/framework/base/UrlManager.php +++ b/framework/base/UrlManager.php @@ -366,7 +366,7 @@ class UrlManager extends Component return isset($_GET[$this->routeVar]) ? $_GET[$this->routeVar] : $r; } if($this->useStrictParsing) - throw new HttpException(404,Yii::t('yii:Unable to resolve the request "{route}".', + throw new HttpException(404,Yii::t('yii|Unable to resolve the request "{route}".', array('{route}'=>$pathInfo))); else return $pathInfo; @@ -502,7 +502,7 @@ class UrlManager extends Component if($value===self::PATH_FORMAT || $value===self::GET_FORMAT) $this->_urlFormat=$value; else - throw new CException(Yii::t('yii:CUrlManager.UrlFormat must be either "path" or "get".')); + throw new CException(Yii::t('yii|CUrlManager.UrlFormat must be either "path" or "get".')); } } @@ -685,7 +685,7 @@ class CUrlRule extends CBaseUrlRule $this->routePattern='/^'.strtr($this->route,$tr2).'$/u'; if(YII_DEBUG && @preg_match($this->pattern,'test')===false) - throw new CException(Yii::t('yii:The URL pattern "{pattern}" for route "{route}" is not a valid regular expression.', + throw new CException(Yii::t('yii|The URL pattern "{pattern}" for route "{route}" is not a valid regular expression.', array('{route}'=>$route,'{pattern}'=>$pattern))); } diff --git a/framework/console/Application.php b/framework/console/Application.php index 7a8de43..5b7d190 100644 --- a/framework/console/Application.php +++ b/framework/console/Application.php @@ -93,7 +93,7 @@ class Application extends \yii\base\Application if ($request->getIsConsoleRequest()) { return $this->runAction($request->route, $request->params); } else { - throw new Exception(\Yii::t('yii:this script must be run from the command line.')); + throw new Exception(\Yii::t('yii|this script must be run from the command line.')); } } @@ -112,7 +112,7 @@ class Application extends \yii\base\Application try { return parent::runAction($route, $params); } catch (InvalidRouteException $e) { - throw new Exception(\Yii::t('yii:Unknown command "{command}".', array('{command}' => $route))); + throw new Exception(\Yii::t('yii|Unknown command "{command}".', array('{command}' => $route))); } } diff --git a/framework/console/Controller.php b/framework/console/Controller.php index b3e9ff7..ff84a45 100644 --- a/framework/console/Controller.php +++ b/framework/console/Controller.php @@ -85,7 +85,7 @@ class Controller extends \yii\base\Controller $args = isset($params[Request::ANONYMOUS_PARAMS]) ? $params[Request::ANONYMOUS_PARAMS] : array(); unset($params[Request::ANONYMOUS_PARAMS]); if ($params !== array()) { - throw new Exception(Yii::t('yii:Unknown options: {params}', array( + throw new Exception(Yii::t('yii|Unknown options: {params}', array( '{params}' => implode(', ', array_keys($params)), ))); } @@ -109,7 +109,7 @@ class Controller extends \yii\base\Controller } if ($missing !== array()) { - throw new Exception(Yii::t('yii:Missing required arguments: {params}', array( + throw new Exception(Yii::t('yii|Missing required arguments: {params}', array( '{params}' => implode(', ', $missing), ))); } diff --git a/framework/console/Exception.php b/framework/console/Exception.php index 052030b..33a06b7 100644 --- a/framework/console/Exception.php +++ b/framework/console/Exception.php @@ -24,7 +24,7 @@ class Exception extends UserException */ public function getName() { - return \Yii::t('yii:Error'); + return \Yii::t('yii|Error'); } } diff --git a/framework/console/controllers/HelpController.php b/framework/console/controllers/HelpController.php index 7e2eab9..4a37f3d 100644 --- a/framework/console/controllers/HelpController.php +++ b/framework/console/controllers/HelpController.php @@ -57,7 +57,7 @@ class HelpController extends Controller if ($command !== null) { $result = Yii::$application->createController($command); if ($result === false) { - throw new Exception(Yii::t('yii:No help for unknown command "{command}".', array( + throw new Exception(Yii::t('yii|No help for unknown command "{command}".', array( '{command}' => $command, ))); } @@ -241,7 +241,7 @@ class HelpController extends Controller { $action = $controller->createAction($actionID); if ($action === null) { - throw new Exception(Yii::t('yii:No help for unknown sub-command "{command}".', array( + throw new Exception(Yii::t('yii|No help for unknown sub-command "{command}".', array( '{command}' => rtrim($controller->getUniqueId() . '/' . $actionID, '/'), ))); } diff --git a/framework/db/Exception.php b/framework/db/Exception.php index 1c4196f..808dc8f 100644 --- a/framework/db/Exception.php +++ b/framework/db/Exception.php @@ -40,6 +40,6 @@ class Exception extends \yii\base\Exception */ public function getName() { - return \Yii::t('yii:Database Exception'); + return \Yii::t('yii|Database Exception'); } } \ No newline at end of file diff --git a/framework/i18n/I18N.php b/framework/i18n/I18N.php index 99a4e69..2cf118f 100644 --- a/framework/i18n/I18N.php +++ b/framework/i18n/I18N.php @@ -13,7 +13,7 @@ class I18N extends Component $language = Yii::$application->language; } - if (preg_match('/^([\w\-]+):(.*)/', $message, $matches)) { + if (preg_match('/^([\w\-\.]+)\|(.*)/', $message, $matches)) { $category = $matches[1]; $message = $matches[2]; } else { diff --git a/framework/logging/EmailTarget.php b/framework/logging/EmailTarget.php index 205cd06..4167b8b 100644 --- a/framework/logging/EmailTarget.php +++ b/framework/logging/EmailTarget.php @@ -50,7 +50,7 @@ class EmailTarget extends Target $body .= $this->formatMessage($message); } $body = wordwrap($body, 70); - $subject = $this->subject === null ? \Yii::t('yii:Application Log') : $this->subject; + $subject = $this->subject === null ? \Yii::t('yii|Application Log') : $this->subject; foreach ($this->emails as $email) { $this->sendEmail($subject, $body, $email, $this->sentFrom, $this->headers); } diff --git a/framework/logging/ProfileTarget.php b/framework/logging/ProfileTarget.php index 30a207c..6030669 100644 --- a/framework/logging/ProfileTarget.php +++ b/framework/logging/ProfileTarget.php @@ -61,7 +61,7 @@ class CProfileLogRoute extends CWebLogRoute if ($value === 'summary' || $value === 'callstack') $this->_report = $value; else - throw new CException(Yii::t('yii:CProfileLogRoute.report "{report}" is invalid. Valid values include "summary" and "callstack".', + throw new CException(Yii::t('yii|CProfileLogRoute.report "{report}" is invalid. Valid values include "summary" and "callstack".', array('{report}' => $value))); } @@ -108,7 +108,7 @@ class CProfileLogRoute extends CWebLogRoute $results[$last[4]] = array($token, $delta, count($stack)); } else { - throw new CException(Yii::t('yii:CProfileLogRoute found a mismatching code block "{token}". Make sure the calls to Yii::beginProfile() and Yii::endProfile() be properly nested.', + throw new CException(Yii::t('yii|CProfileLogRoute found a mismatching code block "{token}". Make sure the calls to Yii::beginProfile() and Yii::endProfile() be properly nested.', array('{token}' => $token))); } } @@ -151,7 +151,7 @@ class CProfileLogRoute extends CWebLogRoute else $results[$token] = array($token, 1, $delta, $delta, $delta); } else - throw new CException(Yii::t('yii:CProfileLogRoute found a mismatching code block "{token}". Make sure the calls to Yii::beginProfile() and Yii::endProfile() be properly nested.', + throw new CException(Yii::t('yii|CProfileLogRoute found a mismatching code block "{token}". Make sure the calls to Yii::beginProfile() and Yii::endProfile() be properly nested.', array('{token}' => $token))); } } diff --git a/framework/validators/BooleanValidator.php b/framework/validators/BooleanValidator.php index a002ba5..acf79be 100644 --- a/framework/validators/BooleanValidator.php +++ b/framework/validators/BooleanValidator.php @@ -54,7 +54,7 @@ class BooleanValidator extends Validator } if (!$this->strict && $value != $this->trueValue && $value != $this->falseValue || $this->strict && $value !== $this->trueValue && $value !== $this->falseValue) { - $message = ($this->message !== null) ? $this->message : \Yii::t('yii:{attribute} must be either {true} or {false}.'); + $message = ($this->message !== null) ? $this->message : \Yii::t('yii|{attribute} must be either {true} or {false}.'); $this->addError($object, $attribute, $message, array( '{true}' => $this->trueValue, '{false}' => $this->falseValue, @@ -70,7 +70,7 @@ class BooleanValidator extends Validator */ public function clientValidateAttribute($object, $attribute) { - $message = ($this->message !== null) ? $this->message : \Yii::t('yii:{attribute} must be either {true} or {false}.'); + $message = ($this->message !== null) ? $this->message : \Yii::t('yii|{attribute} must be either {true} or {false}.'); $message = strtr($message, array( '{attribute}' => $object->getAttributeLabel($attribute), '{value}' => $object->$attribute, diff --git a/framework/validators/CaptchaValidator.php b/framework/validators/CaptchaValidator.php index e936f63..1b6c303 100644 --- a/framework/validators/CaptchaValidator.php +++ b/framework/validators/CaptchaValidator.php @@ -49,7 +49,7 @@ class CaptchaValidator extends Validator } $captcha = $this->getCaptchaAction(); if (!$captcha->validate($value, $this->caseSensitive)) { - $message = $this->message !== null ? $this->message : \Yii::t('yii:The verification code is incorrect.'); + $message = $this->message !== null ? $this->message : \Yii::t('yii|The verification code is incorrect.'); $this->addError($object, $attribute, $message); } } @@ -85,7 +85,7 @@ class CaptchaValidator extends Validator public function clientValidateAttribute($object, $attribute) { $captcha = $this->getCaptchaAction(); - $message = $this->message !== null ? $this->message : \Yii::t('yii:The verification code is incorrect.'); + $message = $this->message !== null ? $this->message : \Yii::t('yii|The verification code is incorrect.'); $message = strtr($message, array( '{attribute}' => $object->getAttributeLabel($attribute), '{value}' => $object->$attribute, diff --git a/framework/validators/CompareValidator.php b/framework/validators/CompareValidator.php index 141cb16..027ee98 100644 --- a/framework/validators/CompareValidator.php +++ b/framework/validators/CompareValidator.php @@ -96,37 +96,37 @@ class CompareValidator extends Validator case '=': case '==': if (($this->strict && $value !== $compareValue) || (!$this->strict && $value != $compareValue)) { - $message = ($this->message !== null) ? $this->message : Yii::t('yii:{attribute} must be repeated exactly.'); + $message = ($this->message !== null) ? $this->message : Yii::t('yii|{attribute} must be repeated exactly.'); $this->addError($object, $attribute, $message, array('{compareAttribute}' => $compareLabel)); } break; case '!=': if (($this->strict && $value === $compareValue) || (!$this->strict && $value == $compareValue)) { - $message = ($this->message !== null) ? $this->message : Yii::t('yii:{attribute} must not be equal to "{compareValue}".'); + $message = ($this->message !== null) ? $this->message : Yii::t('yii|{attribute} must not be equal to "{compareValue}".'); $this->addError($object, $attribute, $message, array('{compareAttribute}' => $compareLabel, '{compareValue}' => $compareValue)); } break; case '>': if ($value <= $compareValue) { - $message = ($this->message !== null) ? $this->message : Yii::t('yii:{attribute} must be greater than "{compareValue}".'); + $message = ($this->message !== null) ? $this->message : Yii::t('yii|{attribute} must be greater than "{compareValue}".'); $this->addError($object, $attribute, $message, array('{compareAttribute}' => $compareLabel, '{compareValue}' => $compareValue)); } break; case '>=': if ($value < $compareValue) { - $message = ($this->message !== null) ? $this->message : Yii::t('yii:{attribute} must be greater than or equal to "{compareValue}".'); + $message = ($this->message !== null) ? $this->message : Yii::t('yii|{attribute} must be greater than or equal to "{compareValue}".'); $this->addError($object, $attribute, $message, array('{compareAttribute}' => $compareLabel, '{compareValue}' => $compareValue)); } break; case '<': if ($value >= $compareValue) { - $message = ($this->message !== null) ? $this->message : Yii::t('yii:{attribute} must be less than "{compareValue}".'); + $message = ($this->message !== null) ? $this->message : Yii::t('yii|{attribute} must be less than "{compareValue}".'); $this->addError($object, $attribute, $message, array('{compareAttribute}' => $compareLabel, '{compareValue}' => $compareValue)); } break; case '<=': if ($value > $compareValue) { - $message = ($this->message !== null) ? $this->message : Yii::t('yii:{attribute} must be less than or equal to "{compareValue}".'); + $message = ($this->message !== null) ? $this->message : Yii::t('yii|{attribute} must be less than or equal to "{compareValue}".'); $this->addError($object, $attribute, $message, array('{compareAttribute}' => $compareLabel, '{compareValue}' => $compareValue)); } break; @@ -158,37 +158,37 @@ class CompareValidator extends Validator case '=': case '==': if ($message === null) { - $message = Yii::t('yii:{attribute} must be repeated exactly.'); + $message = Yii::t('yii|{attribute} must be repeated exactly.'); } $condition = 'value!=' . $compareValue; break; case '!=': if ($message === null) { - $message = Yii::t('yii:{attribute} must not be equal to "{compareValue}".'); + $message = Yii::t('yii|{attribute} must not be equal to "{compareValue}".'); } $condition = 'value==' . $compareValue; break; case '>': if ($message === null) { - $message = Yii::t('yii:{attribute} must be greater than "{compareValue}".'); + $message = Yii::t('yii|{attribute} must be greater than "{compareValue}".'); } $condition = 'value<=' . $compareValue; break; case '>=': if ($message === null) { - $message = Yii::t('yii:{attribute} must be greater than or equal to "{compareValue}".'); + $message = Yii::t('yii|{attribute} must be greater than or equal to "{compareValue}".'); } $condition = 'value<' . $compareValue; break; case '<': if ($message === null) { - $message = Yii::t('yii:{attribute} must be less than "{compareValue}".'); + $message = Yii::t('yii|{attribute} must be less than "{compareValue}".'); } $condition = 'value>=' . $compareValue; break; case '<=': if ($message === null) { - $message = Yii::t('yii:{attribute} must be less than or equal to "{compareValue}".'); + $message = Yii::t('yii|{attribute} must be less than or equal to "{compareValue}".'); } $condition = 'value>' . $compareValue; break; diff --git a/framework/validators/DateValidator.php b/framework/validators/DateValidator.php index af97a71..020d0ed 100644 --- a/framework/validators/DateValidator.php +++ b/framework/validators/DateValidator.php @@ -66,7 +66,7 @@ class DateValidator extends Validator } if (!$valid) { - $message = ($this->message !== null) ? $this->message : \Yii::t('yii:The format of {attribute} is invalid.'); + $message = ($this->message !== null) ? $this->message : \Yii::t('yii|The format of {attribute} is invalid.'); $this->addError($object, $attribute, $message); } } diff --git a/framework/validators/EmailValidator.php b/framework/validators/EmailValidator.php index b78b2da..7bb6bb2 100644 --- a/framework/validators/EmailValidator.php +++ b/framework/validators/EmailValidator.php @@ -63,7 +63,7 @@ class EmailValidator extends Validator return; } if (!$this->validateValue($value)) { - $message = ($this->message !== null) ? $this->message : \Yii::t('yii:{attribute} is not a valid email address.'); + $message = ($this->message !== null) ? $this->message : \Yii::t('yii|{attribute} is not a valid email address.'); $this->addError($object, $attribute, $message); } } @@ -100,7 +100,7 @@ class EmailValidator extends Validator */ public function clientValidateAttribute($object, $attribute) { - $message = ($this->message !== null) ? $this->message : \Yii::t('yii:{attribute} is not a valid email address.'); + $message = ($this->message !== null) ? $this->message : \Yii::t('yii|{attribute} is not a valid email address.'); $message = strtr($message, array( '{attribute}' => $object->getAttributeLabel($attribute), '{value}' => $object->$attribute, diff --git a/framework/validators/ExistValidator.php b/framework/validators/ExistValidator.php index 9d253c9..5f590ba 100644 --- a/framework/validators/ExistValidator.php +++ b/framework/validators/ExistValidator.php @@ -68,7 +68,7 @@ class ExistValidator extends Validator $query = $className::find(); $query->where(array($column->name => $value)); if (!$query->exists()) { - $message = ($this->message !== null) ? $this->message : \Yii::t('yii:{attribute} "{value}" is invalid.'); + $message = ($this->message !== null) ? $this->message : \Yii::t('yii|{attribute} "{value}" is invalid.'); $this->addError($object, $attribute, $message); } } diff --git a/framework/validators/FileValidator.php b/framework/validators/FileValidator.php index c558b76..bde3a6f 100644 --- a/framework/validators/FileValidator.php +++ b/framework/validators/FileValidator.php @@ -115,7 +115,7 @@ class CFileValidator extends Validator return $this->emptyAttribute($object, $attribute); if (count($files) > $this->maxFiles) { - $message = $this->tooMany !== null ? $this->tooMany : \Yii::t('yii:{attribute} cannot accept more than {limit} files.'); + $message = $this->tooMany !== null ? $this->tooMany : \Yii::t('yii|{attribute} cannot accept more than {limit} files.'); $this->addError($object, $attribute, $message, array('{attribute}' => $attribute, '{limit}' => $this->maxFiles)); } else foreach ($files as $file) @@ -145,20 +145,20 @@ class CFileValidator extends Validator return $this->emptyAttribute($object, $attribute); elseif ($error == UPLOAD_ERR_INI_SIZE || $error == UPLOAD_ERR_FORM_SIZE || $this->maxSize !== null && $file->getSize() > $this->maxSize) { - $message = $this->tooLarge !== null ? $this->tooLarge : \Yii::t('yii:The file "{file}" is too large. Its size cannot exceed {limit} bytes.'); + $message = $this->tooLarge !== null ? $this->tooLarge : \Yii::t('yii|The file "{file}" is too large. Its size cannot exceed {limit} bytes.'); $this->addError($object, $attribute, $message, array('{file}' => $file->getName(), '{limit}' => $this->getSizeLimit())); } elseif ($error == UPLOAD_ERR_PARTIAL) - throw new CException(\Yii::t('yii:The file "{file}" was only partially uploaded.', array('{file}' => $file->getName()))); + throw new CException(\Yii::t('yii|The file "{file}" was only partially uploaded.', array('{file}' => $file->getName()))); elseif ($error == UPLOAD_ERR_NO_TMP_DIR) - throw new CException(\Yii::t('yii:Missing the temporary folder to store the uploaded file "{file}".', array('{file}' => $file->getName()))); + throw new CException(\Yii::t('yii|Missing the temporary folder to store the uploaded file "{file}".', array('{file}' => $file->getName()))); elseif ($error == UPLOAD_ERR_CANT_WRITE) - throw new CException(\Yii::t('yii:Failed to write the uploaded file "{file}" to disk.', array('{file}' => $file->getName()))); + throw new CException(\Yii::t('yii|Failed to write the uploaded file "{file}" to disk.', array('{file}' => $file->getName()))); elseif (defined('UPLOAD_ERR_EXTENSION') && $error == UPLOAD_ERR_EXTENSION) // available for PHP 5.2.0 or above - throw new CException(\Yii::t('yii:File upload was stopped by extension.')); + throw new CException(\Yii::t('yii|File upload was stopped by extension.')); if ($this->minSize !== null && $file->getSize() < $this->minSize) { - $message = $this->tooSmall !== null ? $this->tooSmall : \Yii::t('yii:The file "{file}" is too small. Its size cannot be smaller than {limit} bytes.'); + $message = $this->tooSmall !== null ? $this->tooSmall : \Yii::t('yii|The file "{file}" is too small. Its size cannot be smaller than {limit} bytes.'); $this->addError($object, $attribute, $message, array('{file}' => $file->getName(), '{limit}' => $this->minSize)); } @@ -170,7 +170,7 @@ class CFileValidator extends Validator $types = $this->types; if (!in_array(strtolower($file->getExtensionName()), $types)) { - $message = $this->wrongType !== null ? $this->wrongType : \Yii::t('yii:The file "{file}" cannot be uploaded. Only files with these extensions are allowed: {extensions}.'); + $message = $this->wrongType !== null ? $this->wrongType : \Yii::t('yii|The file "{file}" cannot be uploaded. Only files with these extensions are allowed: {extensions}.'); $this->addError($object, $attribute, $message, array('{file}' => $file->getName(), '{extensions}' => implode(', ', $types))); } } @@ -185,7 +185,7 @@ class CFileValidator extends Validator { if (!$this->allowEmpty) { - $message = $this->message !== null ? $this->message : \Yii::t('yii:{attribute} cannot be blank.'); + $message = $this->message !== null ? $this->message : \Yii::t('yii|{attribute} cannot be blank.'); $this->addError($object, $attribute, $message); } } diff --git a/framework/validators/NumberValidator.php b/framework/validators/NumberValidator.php index d459fb8..5ca40c6 100644 --- a/framework/validators/NumberValidator.php +++ b/framework/validators/NumberValidator.php @@ -73,21 +73,21 @@ class NumberValidator extends Validator } if ($this->integerOnly) { if (!preg_match($this->integerPattern, "$value")) { - $message = $this->message !== null ? $this->message : Yii::t('yii:{attribute} must be an integer.'); + $message = $this->message !== null ? $this->message : Yii::t('yii|{attribute} must be an integer.'); $this->addError($object, $attribute, $message); } } else { if (!preg_match($this->numberPattern, "$value")) { - $message = $this->message !== null ? $this->message : Yii::t('yii:{attribute} must be a number.'); + $message = $this->message !== null ? $this->message : Yii::t('yii|{attribute} must be a number.'); $this->addError($object, $attribute, $message); } } if ($this->min !== null && $value < $this->min) { - $message = $this->tooSmall !== null ? $this->tooSmall : Yii::t('yii:{attribute} is too small (minimum is {min}).'); + $message = $this->tooSmall !== null ? $this->tooSmall : Yii::t('yii|{attribute} is too small (minimum is {min}).'); $this->addError($object, $attribute, $message, array('{min}' => $this->min)); } if ($this->max !== null && $value > $this->max) { - $message = $this->tooBig !== null ? $this->tooBig : Yii::t('yii:{attribute} is too big (maximum is {max}).'); + $message = $this->tooBig !== null ? $this->tooBig : Yii::t('yii|{attribute} is too big (maximum is {max}).'); $this->addError($object, $attribute, $message, array('{max}' => $this->max)); } } @@ -103,8 +103,8 @@ class NumberValidator extends Validator $label = $object->getAttributeLabel($attribute); if (($message = $this->message) === null) { - $message = $this->integerOnly ? Yii::t('yii:{attribute} must be an integer.') - : Yii::t('yii:{attribute} must be a number.'); + $message = $this->integerOnly ? Yii::t('yii|{attribute} must be an integer.') + : Yii::t('yii|{attribute} must be a number.'); } $message = strtr($message, array( '{attribute}' => $label, @@ -118,7 +118,7 @@ if(!value.match($pattern)) { "; if ($this->min !== null) { if (($tooSmall = $this->tooSmall) === null) { - $tooSmall = Yii::t('yii:{attribute} is too small (minimum is {min}).'); + $tooSmall = Yii::t('yii|{attribute} is too small (minimum is {min}).'); } $tooSmall = strtr($tooSmall, array( '{attribute}' => $label, @@ -133,7 +133,7 @@ if(value<{$this->min}) { } if ($this->max !== null) { if (($tooBig = $this->tooBig) === null) { - $tooBig = Yii::t('yii:{attribute} is too big (maximum is {max}).'); + $tooBig = Yii::t('yii|{attribute} is too big (maximum is {max}).'); } $tooBig = strtr($tooBig, array( '{attribute}' => $label, diff --git a/framework/validators/RangeValidator.php b/framework/validators/RangeValidator.php index 6abf81f..9119eef 100644 --- a/framework/validators/RangeValidator.php +++ b/framework/validators/RangeValidator.php @@ -58,10 +58,10 @@ class RangeValidator extends Validator throw new InvalidConfigException('The "range" property must be specified as an array.'); } if (!$this->not && !in_array($value, $this->range, $this->strict)) { - $message = ($this->message !== null) ? $this->message : \Yii::t('yii:{attribute} should be in the list.'); + $message = ($this->message !== null) ? $this->message : \Yii::t('yii|{attribute} should be in the list.'); $this->addError($object, $attribute, $message); } elseif ($this->not && in_array($value, $this->range, $this->strict)) { - $message = ($this->message !== null) ? $this->message : \Yii::t('yii:{attribute} should NOT be in the list.'); + $message = ($this->message !== null) ? $this->message : \Yii::t('yii|{attribute} should NOT be in the list.'); $this->addError($object, $attribute, $message); } } @@ -80,7 +80,7 @@ class RangeValidator extends Validator } if (($message = $this->message) === null) { - $message = $this->not ? \Yii::t('yii:{attribute} should NOT be in the list.') : \Yii::t('yii:{attribute} should be in the list.'); + $message = $this->not ? \Yii::t('yii|{attribute} should NOT be in the list.') : \Yii::t('yii|{attribute} should be in the list.'); } $message = strtr($message, array( '{attribute}' => $object->getAttributeLabel($attribute), diff --git a/framework/validators/RegularExpressionValidator.php b/framework/validators/RegularExpressionValidator.php index 1e034f7..456b01e 100644 --- a/framework/validators/RegularExpressionValidator.php +++ b/framework/validators/RegularExpressionValidator.php @@ -51,7 +51,7 @@ class RegularExpressionValidator extends Validator throw new \yii\base\Exception('The "pattern" property must be specified with a valid regular expression.'); } if ((!$this->not && !preg_match($this->pattern, $value)) || ($this->not && preg_match($this->pattern, $value))) { - $message = ($this->message !== null) ? $this->message : \Yii::t('yii:{attribute} is invalid.'); + $message = ($this->message !== null) ? $this->message : \Yii::t('yii|{attribute} is invalid.'); $this->addError($object, $attribute, $message); } } @@ -69,7 +69,7 @@ class RegularExpressionValidator extends Validator throw new \yii\base\Exception('The "pattern" property must be specified with a valid regular expression.'); } - $message = ($this->message !== null) ? $this->message : \Yii::t('yii:{attribute} is invalid.'); + $message = ($this->message !== null) ? $this->message : \Yii::t('yii|{attribute} is invalid.'); $message = strtr($message, array( '{attribute}' => $object->getAttributeLabel($attribute), '{value}' => $object->$attribute, diff --git a/framework/validators/RequiredValidator.php b/framework/validators/RequiredValidator.php index af03221..a80733d 100644 --- a/framework/validators/RequiredValidator.php +++ b/framework/validators/RequiredValidator.php @@ -47,12 +47,12 @@ class RequiredValidator extends Validator $value = $object->$attribute; if ($this->requiredValue === null) { if ($this->strict && $value === null || !$this->strict && $this->isEmpty($value, true)) { - $message = ($this->message !== null) ? $this->message : \Yii::t('yii:{attribute} cannot be blank.'); + $message = ($this->message !== null) ? $this->message : \Yii::t('yii|{attribute} cannot be blank.'); $this->addError($object, $attribute, $message); } } else { if (!$this->strict && $value != $this->requiredValue || $this->strict && $value !== $this->requiredValue) { - $message = ($this->message !== null) ? $this->message : \Yii::t('yii:{attribute} must be "{requiredValue}".'); + $message = ($this->message !== null) ? $this->message : \Yii::t('yii|{attribute} must be "{requiredValue}".'); $this->addError($object, $attribute, $message, array( '{requiredValue}' => $this->requiredValue, )); @@ -71,7 +71,7 @@ class RequiredValidator extends Validator $message = $this->message; if ($this->requiredValue !== null) { if ($message === null) { - $message = \Yii::t('yii:{attribute} must be "{requiredValue}".'); + $message = \Yii::t('yii|{attribute} must be "{requiredValue}".'); } $message = strtr($message, array( '{attribute}' => $object->getAttributeLabel($attribute), @@ -85,7 +85,7 @@ if (value != " . json_encode($this->requiredValue) . ") { "; } else { if ($message === null) { - $message = \Yii::t('yii:{attribute} cannot be blank.'); + $message = \Yii::t('yii|{attribute} cannot be blank.'); } $message = strtr($message, array( '{attribute}' => $object->getAttributeLabel($attribute), diff --git a/framework/validators/StringValidator.php b/framework/validators/StringValidator.php index 4db29d3..c57e183 100644 --- a/framework/validators/StringValidator.php +++ b/framework/validators/StringValidator.php @@ -76,7 +76,7 @@ class StringValidator extends Validator } if (!is_string($value)) { - $message = ($this->message !== null) ? $this->message : \Yii::t('yii:{attribute} must be a string.'); + $message = ($this->message !== null) ? $this->message : \Yii::t('yii|{attribute} must be a string.'); $this->addError($object, $attribute, $message); return; } @@ -88,15 +88,15 @@ class StringValidator extends Validator } if ($this->min !== null && $length < $this->min) { - $message = ($this->tooShort !== null) ? $this->tooShort : \Yii::t('yii:{attribute} is too short (minimum is {min} characters).'); + $message = ($this->tooShort !== null) ? $this->tooShort : \Yii::t('yii|{attribute} is too short (minimum is {min} characters).'); $this->addError($object, $attribute, $message, array('{min}' => $this->min)); } if ($this->max !== null && $length > $this->max) { - $message = ($this->tooLong !== null) ? $this->tooLong : \Yii::t('yii:{attribute} is too long (maximum is {max} characters).'); + $message = ($this->tooLong !== null) ? $this->tooLong : \Yii::t('yii|{attribute} is too long (maximum is {max} characters).'); $this->addError($object, $attribute, $message, array('{max}' => $this->max)); } if ($this->is !== null && $length !== $this->is) { - $message = ($this->notEqual !== null) ? $this->notEqual : \Yii::t('yii:{attribute} is of the wrong length (should be {length} characters).'); + $message = ($this->notEqual !== null) ? $this->notEqual : \Yii::t('yii|{attribute} is of the wrong length (should be {length} characters).'); $this->addError($object, $attribute, $message, array('{length}' => $this->is)); } } @@ -113,7 +113,7 @@ class StringValidator extends Validator $value = $object->$attribute; if (($notEqual = $this->notEqual) === null) { - $notEqual = \Yii::t('yii:{attribute} is of the wrong length (should be {length} characters).'); + $notEqual = \Yii::t('yii|{attribute} is of the wrong length (should be {length} characters).'); } $notEqual = strtr($notEqual, array( '{attribute}' => $label, @@ -122,7 +122,7 @@ class StringValidator extends Validator )); if (($tooShort = $this->tooShort) === null) { - $tooShort = \Yii::t('yii:{attribute} is too short (minimum is {min} characters).'); + $tooShort = \Yii::t('yii|{attribute} is too short (minimum is {min} characters).'); } $tooShort = strtr($tooShort, array( '{attribute}' => $label, @@ -131,7 +131,7 @@ class StringValidator extends Validator )); if (($tooLong = $this->tooLong) === null) { - $tooLong = \Yii::t('yii:{attribute} is too long (maximum is {max} characters).'); + $tooLong = \Yii::t('yii|{attribute} is too long (maximum is {max} characters).'); } $tooLong = strtr($tooLong, array( '{attribute}' => $label, diff --git a/framework/validators/UniqueValidator.php b/framework/validators/UniqueValidator.php index 758d44f..5c2ab86 100644 --- a/framework/validators/UniqueValidator.php +++ b/framework/validators/UniqueValidator.php @@ -86,7 +86,7 @@ class UniqueValidator extends Validator } if ($exists) { - $message = $this->message !== null ? $this->message : \Yii::t('yii:{attribute} "{value}" has already been taken.'); + $message = $this->message !== null ? $this->message : \Yii::t('yii|{attribute} "{value}" has already been taken.'); $this->addError($object, $attribute, $message); } } diff --git a/framework/validators/UrlValidator.php b/framework/validators/UrlValidator.php index 768e8d4..55d8433 100644 --- a/framework/validators/UrlValidator.php +++ b/framework/validators/UrlValidator.php @@ -55,7 +55,7 @@ class UrlValidator extends Validator if (($value = $this->validateValue($value)) !== false) { $object->$attribute = $value; } else { - $message = ($this->message !== null) ? $this->message : \Yii::t('yii:{attribute} is not a valid URL.'); + $message = ($this->message !== null) ? $this->message : \Yii::t('yii|{attribute} is not a valid URL.'); $this->addError($object, $attribute, $message); } } @@ -97,7 +97,7 @@ class UrlValidator extends Validator */ public function clientValidateAttribute($object, $attribute) { - $message = ($this->message !== null) ? $this->message : \Yii::t('yii:{attribute} is not a valid URL.'); + $message = ($this->message !== null) ? $this->message : \Yii::t('yii|{attribute} is not a valid URL.'); $message = strtr($message, array( '{attribute}' => $object->getAttributeLabel($attribute), '{value}' => $object->$attribute, diff --git a/framework/web/AssetManager.php b/framework/web/AssetManager.php index bf27e6a..1c5965a 100644 --- a/framework/web/AssetManager.php +++ b/framework/web/AssetManager.php @@ -113,7 +113,7 @@ class CAssetManager extends CApplicationComponent if(($basePath=realpath($value))!==false && is_dir($basePath) && is_writable($basePath)) $this->_basePath=$basePath; else - throw new CException(Yii::t('yii:CAssetManager.basePath "{path}" is invalid. Please make sure the directory exists and is writable by the Web server process.', + throw new CException(Yii::t('yii|CAssetManager.basePath "{path}" is invalid. Please make sure the directory exists and is writable by the Web server process.', array('{path}'=>$value))); } @@ -236,7 +236,7 @@ class CAssetManager extends CApplicationComponent return $this->_published[$path]=$this->getBaseUrl().'/'.$dir; } } - throw new CException(Yii::t('yii:The asset "{asset}" to be published does not exist.', + throw new CException(Yii::t('yii|The asset "{asset}" to be published does not exist.', array('{asset}'=>$path))); } diff --git a/framework/web/Controller.php b/framework/web/Controller.php index e4c36c9..6c0bc28 100644 --- a/framework/web/Controller.php +++ b/framework/web/Controller.php @@ -45,7 +45,7 @@ class Controller extends \yii\base\Controller */ public function invalidActionParams($action, $exception) { - throw new HttpException(400, \Yii::t('yii:Your request is invalid.')); + throw new HttpException(400, \Yii::t('yii|Your request is invalid.')); } /** diff --git a/framework/web/Request.php b/framework/web/Request.php index 9566974..68d6044 100644 --- a/framework/web/Request.php +++ b/framework/web/Request.php @@ -823,7 +823,7 @@ class Request extends \yii\base\Request $valid = false; } if (!$valid) { - throw new CHttpException(400, Yii::t('yii:The CSRF token could not be verified.')); + throw new CHttpException(400, Yii::t('yii|The CSRF token could not be verified.')); } } } diff --git a/framework/web/Session.php b/framework/web/Session.php index 2b23e62..83c7ed9 100644 --- a/framework/web/Session.php +++ b/framework/web/Session.php @@ -115,7 +115,7 @@ class CHttpSession extends CApplicationComponent implements IteratorAggregate,Ar @session_start(); if(YII_DEBUG && session_id()=='') { - $message=Yii::t('yii:Failed to start session.'); + $message=Yii::t('yii|Failed to start session.'); if(function_exists('error_get_last')) { $error=error_get_last(); @@ -215,7 +215,7 @@ class CHttpSession extends CApplicationComponent implements IteratorAggregate,Ar if(is_dir($value)) session_save_path($value); else - throw new CException(Yii::t('yii:CHttpSession.savePath "{path}" is not a valid directory.', + throw new CException(Yii::t('yii|CHttpSession.savePath "{path}" is not a valid directory.', array('{path}'=>$value))); } @@ -280,7 +280,7 @@ class CHttpSession extends CApplicationComponent implements IteratorAggregate,Ar ini_set('session.use_only_cookies','1'); } else - throw new CException(Yii::t('yii:CHttpSession.cookieMode can only be "none", "allow" or "only".')); + throw new CException(Yii::t('yii|CHttpSession.cookieMode can only be "none", "allow" or "only".')); } /** @@ -304,7 +304,7 @@ class CHttpSession extends CApplicationComponent implements IteratorAggregate,Ar ini_set('session.gc_divisor','100'); } else - throw new CException(Yii::t('yii:CHttpSession.gcProbability "{value}" is invalid. It must be an integer between 0 and 100.', + throw new CException(Yii::t('yii|CHttpSession.gcProbability "{value}" is invalid. It must be an integer between 0 and 100.', array('{value}'=>$value))); }