-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
system.languages.session_store_active: Language never stored in, or retrieved from session #3269
Comments
The language code should really be inside an event |
mahagr
added a commit
that referenced
this issue
Apr 9, 2021
@pamtbaau Can you test my fix? :) |
Just did and it seems to be working fine.
|
nbusseneau
added a commit
to nbusseneau/grav
that referenced
this issue
Oct 12, 2021
At the moment and since 1.7.19, the `system.languages.session_store_active` setting has no effect. Session must be initialized before URI for `$language->setActiveFromUri($uri)` (called from `$this->initializeUri($config) -> $uri->init()`) to properly retrieve / store `active_language` in Session. This was previously detected in getgrav#3269 as per the code comment, but got reversed in 2e9fe80.
mahagr
pushed a commit
that referenced
this issue
Oct 20, 2021
At the moment and since 1.7.19, the `system.languages.session_store_active` setting has no effect. Session must be initialized before URI for `$language->setActiveFromUri($uri)` (called from `$this->initializeUri($config) -> $uri->init()`) to properly retrieve / store `active_language` in Session. This was previously detected in #3269 as per the code comment, but got reversed in 2e9fe80.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The following setting in
system.yaml
is supposed to store the chosen language extension in the url into the session:However, the chosen language will never be stored in, nor retrieved from, the session, because function
Language::setActiveFromUri($uri)
is called before the session has been initialized.InitializeProcessor.php
In
InitializeProcessor::process()
, the line$this->initializeUri($config);
, which callsLanguage::setActiveFromUri($uri)
is executed before$this->initializeSession($config);
grav/system/src/Grav/Common/Processors/InitializeProcessor.php
Lines 104 to 123 in a67a538
Language.php
Because of the above, the following if-statements, meant to store and retrieve the language value from the session, will always evaluate to
false
:grav/system/src/Grav/Common/Language/Language.php
Lines 249 to 261 in a67a538
The text was updated successfully, but these errors were encountered: