Closed PeterSiegl closed 8 years ago
Replicated on the Multilang Skeleton, with this configuration it does not go back to the site default language.
When clicking on the English link (default lang) when the browser lang is != english, it redirects to the browser language. All the other links work fine. So I guess it's just a problem with the default lang.
After inspecting the code, it's by design. Grav determines the language by the URL, so if no lang is set in the URL, and http_accept_language
is true, it gets the browser language.
The only way to work in this situation is to have include_default_lang
true.
Maybe this could be turned into a feature request.
There's also the session_store_active: true
- Shouldn't it be possible to extend that functionality in a way that allows the user to manually set the preferred language just by switching to another language after it got redirected to the browsers language once?
To clarify an example on how the optimal functionality would look like in my opinion:
@SirNovi Yeah exactly, that'd be great! :+1:
@flaviocopes Okay... can you think of a workaround? Could I do the language detection myself (get browser lang, select lang, create cookie resp. check cookie) and somehow set the active language before Grav starts to render the website?
Please, can we have an ETA for fixing this or at least a workaround we can use?
Can someone please test this again with latest Grav 1.1 beta?
The current behaviour is this: if a user reaches site.com, it's redirected to the browser language page, if existing, or if not, it sees the default language.
From site.com/it
(for example), if I type site.com
in the browser, I'm redirected to my language page (site.com/it
). 🆗
If I click site.com/en
, I see site.com
in english, as I chose english. If now I go back to site.com
, I will see the english version of the site. 🆗
So this now plays well with the language chooser plugin, or simply having a flag that points to site.com/en
(of course, you can change /en
with the default language)
The current behavior I'm experiencing is quite different. Whatever language I switch to going back to site.com
returns to the default language.
e.g. site.com/it
I see site.com in Italian
- now if I go back to site.com
I see it in English (default), my language preference doesn't persist.
Could be your system settings? What's your system.yaml file content?
Looks like there is a bug using the
http_accept_language
option withinclude_default_lang: false
.Let's say the default language is english and the configuration in the system.yaml looks like this:
If I set the browser language to e.g. german, grav redirects me correctly to the german page version. But if I want to switch back to the english version (the default language without the language slug in all urls) I always get redirected to the german version. If I set
include_default_lang
totrue
(the default language slug appears in the url again) everything works fine. Any ideas?