How do I programmatically set the preferred language for a user?
Seems D8 doesn't have a setPreferredLangcode method yet. So, the preferred approach IMHO would be to use the default set method of D8 Entity API as below
$user = \Drupal\user\Entity\User::load('uid');
$user-&gt;set('preferred_langcode', 'en or whatever langcode we want');
$user-&gt;save();