From 2c8d5da9e637468af2011cefeb8578a96a2fdf2b Mon Sep 17 00:00:00 2001 From: XAKEPEHOK Date: Sat, 27 Aug 2016 21:26:23 +0300 Subject: [PATCH] Fix problem on Chinese ( zh-TW,zh-CN) https://github.com/yiidoc/yii2-timeago/issues/5#issuecomment-242926593 --- TimeAgo.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/TimeAgo.php b/TimeAgo.php index e21fc69..6891f2d 100644 --- a/TimeAgo.php +++ b/TimeAgo.php @@ -49,7 +49,11 @@ class TimeAgo extends Widget public function init() { - if ($this->language === null) $this->language = substr(\Yii::$app->language,0,2); + if ($this->language === null) { + $lang = substr(\Yii::$app->language,0,2); + if ($lang == 'zn') $lang = \Yii::$app->language; + $this->language = $lang; + } $this->options['data-toggle'] = ArrayHelper::getValue($this->options, 'data-toggle', 'timeago'); $this->registerLocale(); if($this->localTitle) {