yii2 Parameterizing Routes other languages

I have problem with routing i want use paramaterized route but i have url on polish format bt controllers , actions on english.


/** example *//

<controller(konto)>/<action> => controller/action

But my controller is named AccountController and action in english but user will put it in polish version

How can i deal with this problem for get faster routing

I don’t think this should be problem you can map your polish routes/urls to english named controller/actions here for example

// you can map your polish to your specific english controller

<controller(konto)>/<action> => account/<action>

<controller(konto)>/<action(foo)> => account/foo

// explicit routes like this what I usually declare 

konto/foo => account/foo

I want make flexible url rule not one rule match to one route.

'<controller:(konto)>/<action> => <controller>/<action>' 

Internationalizing the routes might be an interesting challenge. Probably you have to write a dedicated URL manager which translates the English routes to the Polish ones when creating URLs, and translates back the Polish routes to the English ones when parsing URLs.

But, well, when you need only one language, for example, the Polish, I would consider naming the controllers and actions using the Polish words - "KontoController" for "AccountController", "actionAktualizacja" for "actonUpdate", … etc.

Thank you very much mate :)

I don’t like mixing the english name classes with other language (not standard coding) but i think it’s better for perfomance.

I thinking about it one week and i’m gonna make your solution and teeth bite for some polish name functions and class name. It will be very good for fast find route.

I really love this framework but i started coding with it last month (before laravel). It will be huge pros when you adding this internatolizaing urlmanager :)

Well if that is the case you extend urlManager and add your functionality, there is a project authors do this but the routes are stored in mysql it called "Open Real Estate" they extended the urlManager to add this functionality look into that maybe it will give you a good starting point.

Its nice to hear you coming from laravel, nothing against laravel we love laravel, welcome to the forums.