Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
$lang_code = 'en';
\Drupal::configFactory()->getEditable('system.site')->set('default_langcode', $lang_code)->save();
From the description of the question it is not very clear why you need it and what the problem is. If you described the problem in more detail, it would be easier for you to advise something.
Especially for this, there is a Language field in the user profile. And in the language detection settings, you can enable the use of the user's language (and even several detection methods and determine their order).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question