The language_select type provides a dropdown that allows the user to select a system language. The #languages attribute determines which set of system languages to use and can be the following:
- LanguageInterface::STATE_CONFIGURABLE: A list of any configured languages on the site
- LanguageInterface::STATE_LOCKED: The languages that are used solely by the system, but not an actual language, that is, Not specified and Not applicable
- LanguageInterface::STATE_ALL: Both the configurable and locked languages
Note that you need to have the Language module enabled for this form type to be displayed. Consider the following example:
$form['langcode'] = array(
'#type' => 'language_select',
'#title' => $this->t('Language'),
'#languages' => LanguageInterface::STATE_ALL,
);

Language select type