Closed StalkAlex closed 8 years ago
This won't work because $role is not a concrete string, but a variable with arbitrary value.
You should wrap your role names in Yii::t()
(wherever you define them), and they will be scanned. This way the getRolesByUser()
will return the translated string.
Ok, also thought about it. But what about such case like view consist of custom strings taken from db. I see one way - add them manually to source table before render. Is there more good way to solve it?
The extension can scan db values. You have to configure which columns need to be translated. See in readme:
'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
]
]
OH, that's right. Thanks again.
I have this lines:
Of course scan will not help me to define such messages and I am not able to translate them, there aren't in table. What's correct way should be? I think adding them manually is not good solution.