/**
* Form constructor for the translation import screen.
*/
public function buildForm(array
$form, FormStateInterface
$form_state) { $languages =
$this->languageManager->
getLanguages();
// Initialize a language list to the ones available, including English if we
// are to translate Drupal to English as well.
$existing_languages =
[];
foreach ($languages as $langcode =>
$language) { if (locale_is_translatable($langcode)) { $existing_languages[$langcode] =
$language->
getName();
} } // If we have no languages available, present the list of predefined
// languages only. If we do have already added languages, set up two option
// groups with the list of existing and then predefined languages.
if (empty($existing_languages)) { $language_options =
$this->languageManager->
getStandardLanguageListWithoutConfigured();
$default =
key($language_options);
}