You are here

public function TranslatorPluginBase::getSupportedLanguagePairs in Translation Management Tool 8

Default implementation that gets target languages for each remote language. This approach is ineffective and therefore it is advised that a plugin should provide own implementation.

Overrides TranslatorPluginInterface::getSupportedLanguagePairs

1 method overrides TranslatorPluginBase::getSupportedLanguagePairs()
LocalTranslator::getSupportedLanguagePairs in translators/tmgmt_local/src/Plugin/tmgmt/Translator/LocalTranslator.php
Default implementation that gets target languages for each remote language. This approach is ineffective and therefore it is advised that a plugin should provide own implementation.

File

src/TranslatorPluginBase.php, line 89

Class

TranslatorPluginBase
Default controller class for service plugins.

Namespace

Drupal\tmgmt

Code

public function getSupportedLanguagePairs(TranslatorInterface $translator) {
  $language_pairs = array();
  foreach ($this
    ->getSupportedRemoteLanguages($translator) as $source_language) {
    foreach ($this
      ->getSupportedTargetLanguages($translator, $source_language) as $target_language) {
      $language_pairs[] = array(
        'source_language' => $source_language,
        'target_language' => $target_language,
      );
    }
  }
  return $language_pairs;
}