machour / yii2-notifications

A complete notifications module for your Yii 2 powered application
MIT License
90 stars 48 forks source link

Problem with language of jquery.timeago #35

Closed ilbassa closed 7 years ago

ilbassa commented 7 years ago

Hi, we have an app with Yii::$app->language set as "it-IT". The problem is that the file "jquery.timeago.it.js" is not read because the extension search for "jquery.timeago.it-IT.js".

It is possible to fix the problem?

machour commented 7 years ago

This have nothing to do with yii2-notifications. (juste change Yii::$app->language to "it" or fix your code calling the javascript)

ilbassa commented 7 years ago

The code that call the javascript is in your extension, so I can fix it until next update...

in NotificatiosWidget, register Assets()

if ($filename = NotificationsAsset::getTimeAgoI18n($this->timeAgoLocale)) {
            $view->registerJsFile($asset->baseUrl . '/' . $filename, [
                'depends' => NotificationsAsset::className()
            ]);
        }

and $this->timeAgoLocale is set in the run()

 if (!isset($this->timeAgoLocale)) {
            $this->timeAgoLocale = Yii::$app->language;
        }
machour commented 7 years ago

Ewww, so sorry for this falsy comment on my side. I'll be fixing that in a few minutes.

machour commented 7 years ago

Should be fine now, update to last version and try again. Thank you for reporting this issue.

ilbassa commented 7 years ago

The language is now loaded correctly. Thanks