How do I programmatically add a new language? I am using Drupal 8 on a multi-lingual site which uses Arabic and French.

I need to programmatically add a new language from a custom module. How can I do it?
You can use below way:

 \Drupal::service('module_installer')-&gt;install(['language']);  
  $langcode = 'ca'; // get language from Your Form Input
    //print_r($langcode);       
  $language = ConfigurableLanguage::createFromLangcode($langcode);
  $language-&gt;save();