You are here

public function GlobalLinkTranslator::getSupportedRemoteLanguages in GlobalLink Connect for Drupal 8.2

Same name and namespace in other branches
  1. 8 src/Plugin/tmgmt/Translator/GlobalLinkTranslator.php \Drupal\globallink\Plugin\tmgmt\Translator\GlobalLinkTranslator::getSupportedRemoteLanguages()

Gets all supported languages of the translator.

This list of all language codes used by the remote translator is then used for example in the translator settings form to select which remote language code correspond to which local language code.

Parameters

TranslatorInterface $translator: Translator entity for which to get supported languages.

Return value

array An array of language codes which are provided by the translator (remote language codes).

Overrides TranslatorPluginBase::getSupportedRemoteLanguages

File

src/Plugin/tmgmt/Translator/GlobalLinkTranslator.php, line 617

Class

GlobalLinkTranslator
GlobalLink translation plugin controller.

Namespace

Drupal\globallink\Plugin\tmgmt\Translator

Code

public function getSupportedRemoteLanguages(TranslatorInterface $translator) {
  $pairs = [];
  $globallink_langcodes = $this->globallinkDefaultLangcodeMapping;
  foreach ($globallink_langcodes as $langcode => $description) {
    $pairs[$langcode] = "{$description} ({$langcode})";
  }
  asort($pairs);
  return $pairs;
}