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

Problem with the configuration file #104

Closed
ydakilux opened this issue Jun 20, 2017 · 1 comment
Closed

Problem with the configuration file #104

ydakilux opened this issue Jun 20, 2017 · 1 comment
Labels

Comments

@ydakilux
Copy link

ydakilux commented Jun 20, 2017

When i used the following configuration

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

I have access to the www.mysite.com/translatemanager en www.mysite.com is not translated

But when I use :

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

My site is translated, but I can't acces anymore to the translatemanager, I get :

exception 'yii\base\InvalidConfigException' with message 'Unable to locate message source for category 'model'.' in /home/admin/web/manager.virtualotc.eu/public_html/vendor/yiisoft/yii2/i18n/I18N.php:200 Stack trace: #0 /home/admin/web/manager.virtualotc.eu/public_html/vendor/yiisoft/yii2/i18n/I18N.php(88): yii\i18n\I18N->getMessageSource('model') #1 /home/admin/web/manager.virtualotc.eu/public_html/vendor/yiisoft/yii2/BaseYii.php(517): yii\i18n\I18N->translate('model', 'Language ID', Array, 'en-US') #2 /home/admin/web/manager.virtualotc.eu/public_html/vendor/lajax/yii2-translate-manager/models/Language.php(95): yii\BaseYii::t('model', 'Language ID') #3 /home/admin/web/manager.virtualotc.eu/public_html/vendor/yiisoft/yii2/db/BaseActiveRecord.php(1552): lajax\translatemanager\models\Language->attributeLabels() #4 /home/admin/web/manager.virtualotc.eu/public_html/vendor/yiisoft/yii2/data/ActiveDataProvider.php(186): yii\db\BaseActiveRecord->getAttributeLabel('language_id') #5 /home/admin/web/manager.virtualotc.eu/public_html/vendor/yiisoft/yii2/base/Component.php(172): yii\data\ActiveDataProvider->setSort(Array) #6 /home/admin/web/manager.virtualotc.eu/public_html/vendor/lajax/yii2-translate-manager/controllers/actions/ListAction.php(38): yii\base\Component->__set('sort', Array) #7 [internal function]: lajax\translatemanager\controllers\actions\ListAction->run() #8 /home/admin/web/manager.virtualotc.eu/public_html/vendor/yiisoft/yii2/base/Action.php(94): call_user_func_array(Array, Array) #9 /home/admin/web/manager.virtualotc.eu/public_html/vendor/yiisoft/yii2/base/Controller.php(156): yii\base\Action->runWithParams(Array) #10 /home/admin/web/manager.virtualotc.eu/public_html/vendor/yiisoft/yii2/base/Module.php(523): yii\base\Controller->runAction('list', Array) #11 /home/admin/web/manager.virtualotc.eu/public_html/vendor/yiisoft/yii2/web/Application.php(102): yii\base\Module->runAction('translatemanage...', Array) #12 /home/admin/web/manager.virtualotc.eu/public_html/vendor/yiisoft/yii2/base/Application.php(380): yii\web\Application->handleRequest(Object(yii\web\Request)) #13 /home/admin/web/manager.virtualotc.eu/public_html/backend/web/index.php(17): yii\base\Application->run() #14 {main}

I'm using : Yii 2.0.12 - PHP 5.6.30-0+deb8u1

Please help

@moltam
Copy link
Collaborator

moltam commented Jun 20, 2017

I think you need both configuration:

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

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

2 participants