Reputation: 1
I want to use JsTrans extension in my yii2 advanced project. https://www.yiiframework.com/extension/jstrans But I have problem with the configuration. After I downloaded the extensions, I extract it in common/extensions folder with name "JsTrans". And then I add this code in my main config:
'components' => [
...
'jsTrans' => array(
// 'class'=>'ext.JsTrans.JsTrans',
'class' => 'common\extensions\JsTrans\JsTrans',
'categories' => array('app'),
'languages' => array('en', 'id'),
// 'defaultLanguage' => 'en', // Optional
)
],
But when I called this in view, I get error: Getting unknown property: yii\web\Application::jstrans My view code
I also tried call it using Yii::$app->jsTrans->init(); but I get another error: Unable to find 'common\extensions\JsTrans\JsTrans' in file: D:\xampp\htdocs\my-project\common/extensions/JsTrans/JsTrans.php. Namespace missing?
Upvotes: 0
Views: 101