0

My urls:

1) It work

http://yii2store/backend/web/en-us/seller/catalog/products

en-us/seller/catalog/products

[
'name' => 'lang_country_module',
'pattern' => '<lang:\w+>-<country:\w+>/<module>/<controller>/<action>',
'route' => '<module>/<controller>/<action>',
],

2) It don`t work

http://yii2store/backend/web/en-us/seller/catalog/attributes/productsattributeslogisticsinfo

en-us : -

seller/catalog/attributes : 3 modules

productsattributeslogisticsinfo : controller

My full rules:

[
                // Lang rule
                'name' => 'lang_country',
                'pattern' => '<lang:\w+>-<country:\w+>/<controller>/<action>', 
                'route' => '<controller>/<action>',

            ],
            [
                'name' => 'lang_country_module',
                'pattern' => '<lang:\w+>-<country:\w+>/<module>/<controller>/<action>',
                'route' => '<module>/<controller>/<action>',
            ],
            [
                'name' => 'lang_country_module2',
                'pattern' => '<lang:\w+>-<country:\w+>/(?J)<module>/<controller>/<action>',
                'route' => '<module>/<controller>/<action>',
            ],
            [
                'name' => 'lang_country_module_only',
                'pattern' => '<lang:\w+>-<country:\w+>/<module>',
                'route' => '<module>',
            ],
            [

                'name' => 'lang_country_module_only2',
                'pattern' => '<lang:\w+>-<country:\w+>/(?J)<module>',
                'route' => '<module>',
            ],

I dont like it

http://yii2store/backend/web/seller/catalog/attributes/attributesproducts?lang=en&country=us

I want

http://yii2store/backend/web/en-us/seller/catalog/attributes/attributesproducts

My

1 Answers1

0

To lang param I propose use codemix/yii2-localeurls. With this you can forget about <lang:\w+> in your patter.

Rafal
  • 573
  • 5
  • 11