Closed kees-closed closed 2 years ago
If you want to use that setting, you need to also make sure you have these (or at least one of them):
system.yaml
languages:
include_default_lang: true # Include the default lang prefix in all URLs
session_store_active: true # Store active language in session
I generally prefer the first option as it keeps languages separated (eg. url based).
Seems like it only works when include_default_lang
is enabled as well.
languages:
supported:
- nl
- en
default_lang: nl
include_default_lang: true
include_default_lang_file_extension: true
translations: true
translations_fallback: true
session_store_active: true
http_accept_language: true
override_locale: true
pages_fallback_only: false
Yeah, as I said, it's the best way. I think both the session and HTTP options require all languages to have their own path to work properly. You can properly make it work without, but it is such a mess that I wouldn't even try. It will never work fully as expected and it will cause major issues with search engines when indexing.
When I add the language switcher to my website, but enable
http_accept_language
inconfig/system.yml
, clicking on anything else than the browser preferred language will fall back to the browser preferred language.langswitcher preferences:
Is there a way to automatically set the language of the browser, but allow a user to switch to another language through the langswitcher plugin? Now these options seem to be fighting. And the
http_accept_language
wins every time.