public function Translator::getSupportedRemoteLanguages

Gets all supported languages of the translator plugin.

Return value

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

Overrides TranslatorInterface::getSupportedRemoteLanguages

1 call to Translator::getSupportedRemoteLanguages()
Translator::mapToRemoteLanguage in src/Entity/Translator.php
Maps local language to remote language.

File

src/Entity/Translator.php, line 342

Class

Translator
Entity class for the tmgmt_translator entity.

Namespace

Drupal\tmgmt\Entity

Code

public function getSupportedRemoteLanguages() {
  if ($plugin = $this
    ->getPlugin()) {
    if (empty($this->remoteLanguages) && ($cache = \Drupal::cache('data')
      ->get('tmgmt_remote_languages:' . $this->name))) {
      $this->remoteLanguages = $cache->data;
    }
    if (empty($this->remoteLanguages)) {
      $this->remoteLanguages = $plugin
        ->getSupportedRemoteLanguages($this);
      $info = $plugin
        ->getPluginDefinition();
      if (!isset($info['language_cache']) || !empty($info['language_cache'])) {
        \Drupal::cache('data')
          ->set('tmgmt_remote_languages:' . $this->name, $this->remoteLanguages, Cache::PERMANENT, $this
          ->getCacheTags());
      }
    }
  }
  return $this->remoteLanguages;
}