lajax / yii2-translate-manager

Translation Manager
MIT License
227 stars 90 forks source link

Scanner is scanning parent root directory (!?) #71

Closed dantux closed 8 years ago

dantux commented 8 years ago

Hi,

I have my application set up with the configuration file at this location: /home/mywww/myapp/frontend/config/main.php In this file, I set up your module and the value for 'root' is dirname(dirname(__DIR__)) which maps to/home/mywww/myapp When I run a scan, I get error messages for not being able to open folders under /home/mywww (outside the 'myapp' folder). Why is that? I also tried to put the path manually like this: 'root'=>'/home/mywww/myapp/' and I get the same result. If I put it like: 'root'=>'/home/mywww/myapp/frontend/', it seems to search 'myapp', but for some reason, it doesn't find any instances of Y::t('app','') in my project. And I have this in every file! What am I doing wrong?

Here is my full config for the module:

    'translatemanager' => [
        'class' => 'lajax\translatemanager\Module',
        //'root' => dirname(dirname(__DIR__)),               // The root directory of the project scan.
        'root' => '/home/mywww/myapp/',               // The root directory of the project scan.
        'layout' => null,//'language',         // Name of the used layout. If using own layout use 'null'.
        'allowedIPs' => ['127.0.0.1'],  // IP addresses from which the translation interface is accessible.
        'roles' => ['theCreator','translator'],               // For setting access levels to the translating interface.
        'tmpDir' => '@runtime',         // Writable directory for the client-side temporary language files. 
                                        // IMPORTANT: must be identical for all applications (the AssetsManager serves the JavaScript files containing language elements from this directory).
        'phpTranslators' => ['::t'],    // list of the php function for translating messages.
        'jsTranslators' => ['lajax.t'], // list of the js function for translating messages.
        'patterns' => ['*.js', '*.php'],// list of file extensions that contain language elements.
        'ignoredCategories' => ['yii'], // these categories won’t be included in the language database.
        'ignoredItems' => ['config'],   // these files will not be processed.
    ],

Any ideas?

moltam commented 8 years ago

See #12.

moltam commented 8 years ago

Scanning multiple directories is now possible with merging #77.

It is also possible to turn off changing the root to its parent directory: #73.

Could you take a look at these in dev-master?

This is strange, I have no idea why this is happening:

If I put it like: 'root'=>'/home/mywww/myapp/frontend/', it seems to search 'myapp', but for some reason, it doesn't find any instances of Y::t('app','') in my project. And I have this in every file!

dantux commented 8 years ago

Thanks a lot Moltam for replying. Really appreciate it. I don't know what I did the first time; probably because I was putting the actual physical path instead of the alias... but when I changed back to the alias, (I created one as a child folder to the root path), it worked! yay!! This is amazing :) I'm so happy :)

Thank you again.