Add locale and requirements to all routes - Symfony2

后端 未结 6 501
离开以前
离开以前 2021-01-04 14:12

I created an application which was not intended to have translations, but now I decided to add this feature. The problem is that all my routes look like this:



        
6条回答
  •  走了就别回头了
    2021-01-04 14:41

    Use JMS18nRoutingBundle (documentation) for this purpose. No custom loader, no coding ...

    The bundle is able to prefix all your routes with the locale without changing anything except some configuration for the bundle. It's the quickest ( and my recommended ) solution to get you started.

    You can even translate existing routes for different locales.

    A quick introduction can be found in this coderwall post.

提交回复
热议问题