You are here

public function TMGMTTranslator::getSupportedTargetLanguages in Translation Management Tool 7

Returns the supported target languages for this translator.

Return value

array An array of supported target languages in ISO format.

File

entity/tmgmt.entity.translator.inc, line 110

Class

TMGMTTranslator
Entity class for the tmgmt_translator entity.

Code

public function getSupportedTargetLanguages($source_language) {
  if ($controller = $this
    ->getController()) {
    if (isset($this->pluginInfo['cache languages']) && empty($this->pluginInfo['cache languages'])) {

      // This plugin doesn't support language caching.
      return $controller
        ->getSupportedTargetLanguages($this, $source_language);
    }
    else {

      // Retrieve the supported languages from the cache.
      if (empty($this->languageCache) && ($cache = cache_get('languages:' . $this->name, 'cache_tmgmt'))) {
        $this->languageCache = $cache->data;
      }

      // Even if we successfully queried the cache it might not have an entry
      // for our source language yet.
      if (!isset($this->languageCache[$source_language])) {
        $this->languageCache[$source_language] = $controller
          ->getSupportedTargetLanguages($this, $source_language);
        $this->languageCacheOutdated = TRUE;
      }
    }
    return $this->languageCache[$source_language];
  }
}