OmgDef / yii2-multilingual-behavior

Yii2 port of the yii-multilingual-behavior.
146 stars 60 forks source link

get languages from db #30

Closed sajtosnorbert closed 6 years ago

sajtosnorbert commented 9 years ago

Hi!

Previously I used the params for the languages, but...

Is there an easy way to get the languages for the behavior from db (ex. language table)?

'languages' => [ 'ru' => 'Russian', 'en-US' => 'English', ],

This part should be get dynamically from the language table.

Thanks for your answer!

Norbert

CyanoFresh commented 9 years ago

Also you have to add support dynamic languages for the form in the view. For subject:

'languages' => Lang::getLangsArray(),

Lang Model:

...
public function getLangsArray()
{
    return self::find()->all();
}
...

I've not tested it, it's only example.