Error message

Warning: count(): Parameter must be an array or an object that implements Countable in _api_make_match_member_link() (line 1230 of /home/projects/api/www/sites/all/modules/api/api.formatting.inc).

function tmgmt_available_languages

Returns an array of languages that are available for translation.

Return value

array An array of languages in ISO format.

8 calls to tmgmt_available_languages()

File

./tmgmt.module, line 138
Main module file for the Translation Management module.

Code

function tmgmt_available_languages($exclude = array()) {
  $languages = \Drupal::languageManager()
    ->getLanguages();

  // Remove the language in $exclude from the list of available languages and
  // then apply a filter that only leaves the supported target languages on
  // the list.
  $labels = array();
  foreach ($languages as $langcode => $language) {
    if (!in_array($langcode, $exclude)) {
      $labels[$langcode] = $language
        ->getName();
    }
  }
  return $labels;
}