lajax / yii2-translate-manager

Translation Manager
MIT License
227 stars 90 forks source link

"Home" action error Not Found (#404) page not found #78

Closed tedyonly closed 7 years ago

tedyonly commented 8 years ago

backend/config/main.php `<?php $params = array_merge( require(DIR . '/../../common/config/params.php'), require(DIR . '/../../common/config/params-local.php'), require(DIR . '/params.php'), require(DIR . '/params-local.php') );

return [ 'id' => 'app-backend', 'basePath' => dirname(DIR), 'controllerNamespace' => 'backend\controllers', 'bootstrap' => ['log'], 'modules' => [], 'homeUrl' => '/project2/administrator',
'components' => [ 'request' => [ 'baseUrl' => '/project2/administrator', ],

    'user' => [
        'identityClass' => 'common\models\User',    
        'enableAutoLogin' => true,                  
        'identityCookie' => [                       
            'name' => '_backendIdentity',           
            'httpOnly' => true,                     
            'path' => '/',
            ],      
    ],
    'session' => [                                  
        'name' => 'BACKENDSESSID',                  
        'cookieParams' => [                         
            'httpOnly' => true,
            'path' => '/',              

        ],
    ],  

    'assetManager' => [
        'bundles' => [
            'dmstr\web\AdminLteAsset' => [
                'skin' => 'skin-red-light',
            ],
        ],
    ],      

    'log' => [
        'traceLevel' => YII_DEBUG ? 3 : 0,
        'targets' => [
            [
                'class' => 'yii\log\FileTarget',
                'levels' => ['error', 'warning'],
            ],
        ],
    ],
    'errorHandler' => [
        'errorAction' => 'site/error',
    ],
],
'params' => $params,

]; `

common/config/main.php `<?php return [ //Default 'vendorPath' => dirname(dirname(DIR)) . '/vendor', 'name'=>'PROJECT2', 'bootstrap' => [ /* 'translate', */
'languagepicker',
'translatemanager' ],
'language' => 'id-ID',
'sourceLanguage' => 'en-US',
'components' => [ //Default 'cache' => [ 'class' => 'yii\caching\FileCache', ],

/* 'i18n' => [ 'class' => 'yii\i18n\I18N', 'translations' => [ '' => [ 'class' => 'conquer\i18n\MessageSource', 'translator' => [ 'class'=>'conquer\i18n\translators\GoogleTranslator', 'apiKey' => 'AIzaSyCl9B5SNTjJdtvuqDUkMF9qIbPj6EeRcms', // 'class'=>'conquer\i18n\translators\YandexTranslator', // 'apiKey' => 'yandex form', ], ], ], ], /

    //  I18n  lajax
    'i18n' => [
        'translations' => [
            '*' => [
                'class' => 'yii\i18n\DbMessageSource',
                'db' => 'db',
                'sourceLanguage' => 'en-US', // Developer language
                'sourceMessageTable' => '{{%language_source}}',
                'messageTable' => '{{%language_translate}}',
                'forceTranslation' => true,
                'cachingDuration' => 86400,
                'enableCaching' => false,
            ],
            'app' => [
                'class' => 'yii\i18n\DbMessageSource',
                'db' => 'db',
                'sourceLanguage' => 'en-US', // Developer language
                'sourceMessageTable' => '{{%language_source}}',
                'messageTable' => '{{%language_translate}}',
                'forceTranslation' => true,
                'cachingDuration' => 86400,
                'enableCaching' => false,
            ],
            'yii' => [
                'class' => 'yii\i18n\DbMessageSource',
                'db' => 'db',
                'sourceLanguage' => 'en-US', // Developer language
                'sourceMessageTable' => '{{%language_source}}',
                'messageTable' => '{{%language_translate}}',
                'forceTranslation' => true,
                'cachingDuration' => 86400,
                'enableCaching' => false,
            ],
        ],
    ],

    // lajax language picker manual pilih
    'languagepicker' => [
        'class' => 'lajax\languagepicker\Component',        // List of available languages (icons and text)
        'languages' => ['id-ID' => 'Bahasa Indonesia']
    ],

    // lajax language picker translatemanager

/* 'languagepicker' => [ 'class' => 'lajax\languagepicker\Component', 'languages' => function () { // List of available languages (icons and text) return \lajax\translatemanager\models\Language::getLanguageNames(true); }, 'cookieName' => 'language', // Name of the cookie. //'cookieDomain' => '//localhost/pustaka', // Domain of the cookie.
'expireDays' => 64, // The expiration time of the cookie is 64 days. 'callback' => function() { if (!\Yii::$app->user->isGuest) { $user = \Yii::$app->user->identity; $user->language = \Yii::$app->language; $user->save(); } } ], */

    'urlManager' => [
        'enablePrettyUrl' => true,
        'showScriptName' => false,
        'rules' => [
            // your rules go here
            ],
            // ...
    ],

],

/* 'modules' => [ 'translate' => 'conquer\i18n\Module', // Untuk I18n

],
     */

// Untuk I18n  lajax
'modules' => [
    'translatemanager' => [
        'class' => 'lajax\translatemanager\Module',
        'root' => '@app',               // The root directory of the project scan.
        'layout' => 'language',         // Name of the used layout. If using own layout use 'null'.
        'allowedIPs' => ['*'],          // IP addresses from which the translation interface is accessible.
        'roles' => ['@'],               // For setting access levels to the translating interface.
        'tmpDir' => '@frontend/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.
        'scanTimeLimit' => null,        // increase to prevent "Maximum execution time" errors, if null the default max_execution_time will be used
        'searchEmptyCommand' => '!',    // the search string to enter in the 'Translation' search field to find not yet translated items, set to null to disable this feature
        'defaultExportStatus' => 1,     // the default selection of languages to export, set to 0 to select all languages by default
        'defaultExportFormat' => 'json',// the default format for export, can be 'json' or 'xml'
        'tables' => [                   // Properties of individual tables
            [
                'connection' => 'db',   // connection identifier
                'table' => '{{%language}}',         // table name
                'columns' => ['name', 'name_ascii'] //names of multilingual fields
            ],
        ]
    ],
],

]; if make comment for this 'enablePrettyUrl' => true, 'showScriptName' => false,`

'Home' action run normal else it goes to frontend even the url show in the browser "//localhost/project2/administrator" till I change to be "//localhost/project2/backend/web" it back normal again. What is going on?

moltam commented 7 years ago

Probably the application cannot determine what is the URI for routing (because it treats the whole URL as the baseUrl). This is not a problem related to this extension.

I am closing this due to inactivity. If the problem still present, please reopen the issue, and provide more detail about what is not working exactly.