I'm trying to set the local automatically if none is specified in the url.
What I want to to realize is:
if the user enters the site www.example.com is automatically set to the English language.
I tried this:
# homepage not localized: load the homepage with default language
index_not_localized:
path: /
defaults: { _controller: "AcmeSiteBundle:Default:index", _locale: en }
acme_site:
resource: "@AcmeSiteBundle/Controller/"
type: annotation
prefix: /{_locale}
defaults: { _locale: en }
requirements:
_locale: en|it
but if I do not put the language in the URL gives me this error:
Unable to generate a URL for the named route "_demo" as such route does not exist.
What am I doing wrong?