Closed romanzipp closed 4 years ago
Got it! I've misunderstood the usage of the magic attribute $request->locale
.
The latest change should comply with your requested changes.
@romanzipp I had to revert the changes because now that I think of it, we don't want to change the locale based on the Accept-Language
header. For instance, my website has a /
which is in French
, and a /en/
in English
, I would not want my root path to be displayed in the header's locale, which is English
.
I've resolved this issue for myself by
/en
, /de
)I've resolved this issue for myself by
- storing a cookie with the currently preferred language
- redirecting the landing page to a specific language (
/en
,/de
)
@romanzipp What if the primary locale has no prefix? For instance, /
content should be loaded in fr
and /some-slug
should be in fr
too. 🤔
Update Laravel request language extraction to use the
getPreferredLanguage
method since thelocale
property on the Symfony request class has protected access.