You are here

public function TMGMTDefaultTranslatorPluginController::mapToRemoteLanguage in Translation Management Tool 7

Maps local language to remote language.

Parameters

TMGMTTranslator $translator: Translator entity for which to get remote language.

$language: Local language code.

Return value

string Remote language code.

Overrides TMGMTTranslatorPluginControllerInterface::mapToRemoteLanguage

1 call to TMGMTDefaultTranslatorPluginController::mapToRemoteLanguage()
TMGMTDefaultTranslatorPluginController::getRemoteLanguagesMappings in plugin/tmgmt.plugin.translator.inc
Gets existing remote languages mappings.

File

plugin/tmgmt.plugin.translator.inc, line 94
Contains the abstract translator base plugin class.

Class

TMGMTDefaultTranslatorPluginController
Default controller class for service plugins.

Code

public function mapToRemoteLanguage(TMGMTTranslator $translator, $language) {
  if (!tmgmt_provide_remote_languages_mappings($translator)) {
    return $language;
  }
  if (!empty($translator->settings['remote_languages_mappings'][$language])) {
    return $translator->settings['remote_languages_mappings'][$language];
  }
  $default_mappings = $this
    ->getDefaultRemoteLanguagesMappings();
  if (isset($default_mappings[$language])) {
    return $default_mappings[$language];
  }
  return $language;
}