Manual setup of user's language I need to switch user's language programmatically. The issue is I don't want it as an url part, and unable to switch it even with the regular language switcher block.

What I've try:


admin/config/regional/language/detection: Disable url, Enable Session
Now the Language Switcher core block adds ?language= to the current path. But this setting does not persist between pages, and does not appears in the session.
manual setup of $_SESSION['language'] does nothing
\Drupal::languageManager()-&gt;setConfigOverrideLanguage($language_manager-&gt;getLanguage($langcode)) does nothing


Drupal version is 8.beta2
I don't really understand your use case correctly, but probably you need to implement a language negotiation manager. See an example at /core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationBrowser.php.

If you also need to change the url for adding language, or changing how the links in language switcher work, you may need to override some more methods. See an example at /core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationUrl.php.