I want to do override LocaleEventListener in Symfony 3 with the following scenario:
Scenario 1:
I need to set Locale in Cookie say for example en|de
Scenario 2:
Need to get requestUri = "/"
and check if we have Locale in the cookie
Scenario 3:
If we have Locale in the previous page ( e.g.: domain.com/en
)
and
now in the root domain ( e.g. domain.com
)
then ==> redirect to domain.com/en
Result: So that user system can detect the previous language in the cookie and redirect to the user if hit on root domain
Purpose: Most users switch the language but sometimes they are opening a new tab with the main domain ( where we have default language ) - but users want their previous language.
How do I overcome this issue by fulfilling the purpose?
Thanks in Advance.