lajax / yii2-translate-manager

Translation Manager
MIT License
227 stars 90 forks source link

Dinamic translate from database #80

Closed igortsev closed 7 years ago

igortsev commented 8 years ago

The default language is set to Italian. When choosing another language everything works great except for those elements which are stored in the database.

In the database I store the products. Through the settings added to the translation table products with fields : name and description.

Yu can see it https://voilasrl.com/product/index And choose another lang

'tables' => [ // Properties of individual tables [ 'connection' => 'db', // connection identifier 'table' => '{{%language}}', // table name 'columns' => ['name', 'name_ascii'],// names of multilingual fields // 'category' => 'database-table-name',// the category is the database table name ], [ 'connection' => 'db', // connection identifier 'table' => '{{%product}}', // table name 'columns' => ['name', 'description'],// names of multilingual fields ], [ 'connection' => 'db', // connection identifier 'table' => '{{%product_category}}', // table name 'columns' => ['name', 'description'],// names of multilingual fields ], [ 'connection' => 'db', // connection identifier 'table' => '{{%tax}}', // table name 'columns' => ['name'],// names of multilingual fields ] ]

Explanation

The language is set as Italian, change the language to Spanish. Product name and description remains in Italian, everything else from the database is translated.

moltam commented 7 years ago

Your tables configuration looks good. You should use the \lajax\translatemanager\helpers\Language::d($text) helper method to translate texts retrieved from your database.

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.