Quantcast
Channel: Active questions tagged symfony4 - Stack Overflow
Viewing all articles
Browse latest Browse all 3925

Prefix routes with dynamic locale depending on user preferences - symfony 4

$
0
0

I’m trying to make the base locale change depending on the user preferences. I know I can change the prefix rules in the config, but I don't know how to make dynamic.

app:    resource: "../src/Controller/"    type: annotation    prefix:        ?: '' # don't prefix URLs for the default locale‘fr|de|es’: ‘{_locale}’

Let’s assume we have Client A and Client B.

Client A

  • Base: EN
  • Secondary: DE, FR


Client B

  • Base: FR
  • Secondary: ES

For the base locale I don’t want any prefix, only for secondary locales.

Example for Client A

‘en’: ‘’‘de’: ’/de’’fr’: ‘/fr’

Example for Client B

‘fr’: ‘’‘es’: ‘/es’

Any clue on how can I achieve this through Symfony? Thanks.


Viewing all articles
Browse latest Browse all 3925

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>