why not generating pretty url

I am trying to generate pretty url using Yii2 helpers. but when there is id It creates like the following


  public function createUrl($params)

    {

 

           if ($this->languagesEnabled() && !isset($params[$this->languageParam]) && !empty(Yii::$app->language))

            $params[$this->languageParam] = substr(Yii::$app->language,0,2);

 

       /* print_r($params);

        exit;*/

 

        return parent::createUrl($params);

    }

 

and in the config file


'urlManager' => [

            //'baseUrl' => '/shopikos',

            'enablePrettyUrl' => true,

            'showScriptName' => false,

            //'suffix'=>'.html',

            'class' => 'frontend\components\LangUrlManager',

            'languages' => array('en' => 'en-US', 'ru' => 'ru'), //assoziative array language => label

           // 'cookieDays' => 30, //keep language 30 days

            'rules' => [

 

                '<lang:(ru|en)>' => 'site/index',

                '<lang:(ru|en)>/<controller:\w+>' => '<controller>/index',

                '<lang:(ru|en)>/<controller:\w+>/<action:\w+>' => '<controller>/<action>',

                '<lang:(ru|en)>/<controller:\w+>/<action:\w+>/<id:\w+>' => '<controller>/<action>',

                '<lang:(ru|en)>/<controller:\w+>/<action:\w+>/<id:\w+>/*' => '<controller>/<action>',

            ]

        ],

after trying to use


Html::a(FA::icon('edit'),['declaration/view', 'id'=>$model->id],['data-pjax'=>0]);

it generates in this way

http://localhost/shopikos/en/declaration/view?id=3

You’re not passing all required arguments. In your case lang is missing.