public function TMGMTTranslator::getSupportedLanguagePairs in Translation Management Tool 7
Gets the supported language pairs for this translator.
Return value
array List of language pairs where a pair is an associative array of source_language and target_language. Example: array( array('source_language' => 'en-US', 'target_language' => 'de-DE'), array('source_language' => 'en-US', 'target_language' => 'de-CH'), )
File
- entity/
tmgmt.entity.translator.inc, line 144
Class
- TMGMTTranslator
- Entity class for the tmgmt_translator entity.
Code
public function getSupportedLanguagePairs() {
if ($controller = $this
->getController()) {
if (isset($this->pluginInfo['cache languages']) && empty($this->pluginInfo['cache languages'])) {
// This plugin doesn't support language caching.
return $controller
->getSupportedLanguagePairs($this);
}
else {
// Retrieve the supported languages from the cache.
if (empty($this->languagePairsCache) && ($cache = cache_get('language_pairs:' . $this->name, 'cache_tmgmt'))) {
$this->languagePairsCache = $cache->data;
}
// Even if we successfully queried the cache data might not be yet
// available.
if (empty($this->languagePairsCache)) {
$this->languagePairsCache = $controller
->getSupportedLanguagePairs($this);
$this->languageCacheOutdated = TRUE;
}
}
return $this->languagePairsCache;
}
}