Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

translate/scan #48

Closed
Lawiet opened this issue Feb 3, 2016 · 6 comments
Closed

translate/scan #48

Lawiet opened this issue Feb 3, 2016 · 6 comments
Labels

Comments

@Lawiet
Copy link

Lawiet commented Feb 3, 2016

Good day,

I try ./yii translate/scan

and

Scanning translations...
PHP Notice 'yii\base\ErrorException' with message 'Trying to get property of non-object'

in /var/www/html/yii/vendor/lajax/yii2-translate-manager/services/Scanner.php:68

Stack trace:
#0 /var/www/html/yii/vendor/lajax/yii2-translate-manager/services/Scanner.php(68): yii\base\ErrorHandler->handleError(8, 'Trying to get p...', '/var/www/html/g...', 68, Array)
#1 /var/www/html/yii/vendor/lajax/yii2-translate-manager/commands/TranslatemanagerController.php(37): lajax\translatemanager\services\Scanner->run()
#2 [internal function]: lajax\translatemanager\commands\TranslatemanagerController->actionScan()
#3 /var/www/html/yii/vendor/yiisoft/yii2/base/InlineAction.php(55): call_user_func_array(Array, Array)
#4 /var/www/html/yii/vendor/yiisoft/yii2/base/Controller.php(151): yii\base\InlineAction->runWithParams(Array)
#5 /var/www/html/yii/vendor/yiisoft/yii2/console/Controller.php(91): yii\base\Controller->runAction('scan', Array)
#6 /var/www/html/yii/vendor/yiisoft/yii2/base/Module.php(455): yii\console\Controller->runAction('scan', Array)
#7 /var/www/html/yii/vendor/yiisoft/yii2/console/Application.php(167): yii\base\Module->runAction('translate/scan', Array)
#8 /var/www/html/yii/vendor/yiisoft/yii2/console/Application.php(143): yii\console\Application->runAction('translate/scan', Array)
#9 /var/www/html/yii/vendor/yiisoft/yii2/base/Application.php(375): yii\console\Application->handleRequest(Object(yii\console\Request))
#10 /var/www/html/yii/yii(19): yii\base\Application->run()
#11 {main}

@moltam
Copy link
Collaborator

moltam commented Feb 3, 2016

Is your Translate Manager module configured properly in the console app?
You should configure the module in the common config, so the scanner can use it.

@Lawiet
Copy link
Author

Lawiet commented Feb 5, 2016

this my web.php

$config = [
'id' => 'basic',
'basePath' => dirname(DIR),
'bootstrap' => ['log','translatemanager','gii','debug'],
'layout' => 'main',
'language' => 'es',
'sourceLanguage' => 'es',
'controllerMap' => [
'translate' => \lajax\translatemanager\commands\TranslatemanagerController::className(),
],

@moltam
Copy link
Collaborator

moltam commented Feb 5, 2016

The module declaration is probably missing. Add this to your config in config/console.php:

'modules' => [
    'translatemanager' => [
        'class' => 'lajax\translatemanager\Module',
    ],
],

@moltam
Copy link
Collaborator

moltam commented Feb 5, 2016

Sorry, I mean config/console.php config file (if you are using basic app).
(I edited the prev. comment)

@moltam
Copy link
Collaborator

moltam commented Feb 5, 2016

Also you should have the same configuration for web and console. I am not very familiar with the basic app, but I think you should create a separate module config file for the extension, then require in each config file.

Create console/translatemanager.php:

return [
    'class' => 'lajax\translatemanager\Module',
    // additional config ...
];

In the web.php and console.php:

'modules' => [
    'translatemanager' => require(__DIR__ . '/translatemanager.php'),
],

@Lawiet
Copy link
Author

Lawiet commented Feb 5, 2016

Ok, very thanks.

console.php

return [
'id' => 'basic-console',
'basePath' => dirname(DIR),
'bootstrap' => ['log', 'gii'],
'controllerNamespace' => 'app\commands',
'modules' => [
'gii' => 'yii\gii\Module',
'translatemanager' => [
'class' => 'lajax\translatemanager\Module',
],
],
'controllerMap' => [
'translate' => \lajax\translatemanager\commands\TranslatemanagerController::className(),
],

and web.php

$config = [
'id' => 'basic',
'basePath' => dirname(DIR),
'bootstrap' => ['log','translatemanager','gii','debug'],
'layout' => 'main',
'language' => 'es',
'sourceLanguage' => 'es',
'controllerMap' => [
'translate' => \lajax\translatemanager\commands\TranslatemanagerController::className(),
],

....

'modules' => [
    /* ********************** SOLO PARA EDICION SEGUN LA IP ********************** */
    'debug' => [
        'class' => 'yii\debug\Module',
        'allowedIPs' => $allowedIPs,
    ],
    'gii' => [
        'class' => 'yii\gii\Module',
        'allowedIPs' => $allowedIPs,
    ],
    'translatemanager' => [
        'class' => 'lajax\translatemanager\Module',
        'root' => '@app',               // The root directory of the project scan.
        'layout' => 'language',

@lajax lajax closed this as completed Mar 24, 2016
@moltam moltam added the question label Jun 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants