multilingual site with language code at the beginning of routes

Hi everyone,

I’ve searched, without success unfortunately.

I have a yii 1.1.14 website that needs to be extended in other languages. I would to know if is possible to have routes like:

Anyone knows some extensions or whatsoever integration?

Thanks a lot

Hi,

You may use a param instead of the route!

Yourdomain.com/lang/en and do the lang key store it into session.

Example code but this is for yii2.x -> this code will be at the bootstrapping event of the web application





$currentLang = \Yii::$app->request->get('lang');

        if (!empty($currentLang)) {

            \Yii::$app->session->set('language', $currentLang);

        }

        $lang = \Yii::$app->session->get('language');

        if (empty($lang)) {

            \Yii::$app->session->set('language', 'en');

        }

        \Yii::$app->language = \Yii::$app->session->get('language');

        return true;



I hope this may help you!