From d0f926306dfcd18642b470ca2d4d64e3de54861d Mon Sep 17 00:00:00 2001 From: reuhtte Date: Sun, 12 Apr 2015 20:21:02 -0500 Subject: [PATCH] i18n "audittrail" category configuration fixed. --- AuditTrail.php | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/AuditTrail.php b/AuditTrail.php index 7cf2612..56c5447 100644 --- a/AuditTrail.php +++ b/AuditTrail.php @@ -19,6 +19,8 @@ */ class AuditTrail extends ActiveRecord { + private $_message_category = 'audittrail'; + /** * @return string the associated database table name */ @@ -31,17 +33,27 @@ public static function tableName() } } - /** - * @return \yii\db\Connection the database connection used by this AR class. - */ - public static function getDb() { - if (isset(Yii::$app->params['audittrail.db'])) { - return Yii::$app->get(Yii::$app->params['audittrail.db']); - } else { - return parent::getDb(); - } - // return Yii::$app->get('dbUser'); + /** + * @return \yii\db\Connection the database connection used by this AR class. + */ + public static function getDb() + { + if (isset(Yii::$app->params['audittrail.db'])) { + return Yii::$app->get(Yii::$app->params['audittrail.db']); + } else { + return parent::getDb(); } + // return Yii::$app->get('dbUser'); + } + + public function init() + { + parent::init(); + + \Yii::$app->i18n->translations[$this->_message_category] = [ + 'class' => 'yii\i18n\PhpMessageSource', + ]; + } /** * @return array customized attribute labels (name=>label)