You are here

public function TranslatorPluginBase::getSupportedTargetLanguages in Translation Management Tool 8

Returns all available target languages that are supported by this service when given a source language.

Parameters

TranslatorInterface $translator: The translator entity.

$source_language: The source language.

Return value

array An array of remote languages in ISO format.

Overrides TranslatorPluginInterface::getSupportedTargetLanguages

2 calls to TranslatorPluginBase::getSupportedTargetLanguages()
LocalTranslator::getSupportedTargetLanguages in translators/tmgmt_local/src/Plugin/tmgmt/Translator/LocalTranslator.php
Returns all available target languages that are supported by this service when given a source language.
TranslatorPluginBase::getSupportedLanguagePairs in src/TranslatorPluginBase.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.
2 methods override TranslatorPluginBase::getSupportedTargetLanguages()
LocalTranslator::getSupportedTargetLanguages in translators/tmgmt_local/src/Plugin/tmgmt/Translator/LocalTranslator.php
Returns all available target languages that are supported by this service when given a source language.
TestTranslator::getSupportedTargetLanguages in tmgmt_test/src/Plugin/tmgmt/Translator/TestTranslator.php
Returns all available target languages that are supported by this service when given a source language.

File

src/TranslatorPluginBase.php, line 77

Class

TranslatorPluginBase
Default controller class for service plugins.

Namespace

Drupal\tmgmt

Code

public function getSupportedTargetLanguages(TranslatorInterface $translator, $source_language) {
  $languages = tmgmt_available_languages();
  return array_combine(array_keys($languages), array_keys($languages));
}