You are here

public function TMGMTGoogleTranslatorPluginController::getSupportedRemoteLanguages in TMGMT Translator Google 7

Overrides TMGMTDefaultTranslatorPluginController::getSupportedRemoteLanguages().

Overrides TMGMTDefaultTranslatorPluginController::getSupportedRemoteLanguages

1 call to TMGMTGoogleTranslatorPluginController::getSupportedRemoteLanguages()
TMGMTGoogleTranslatorPluginController::getSupportedTargetLanguages in ./tmgmt_google.plugin.inc
Overrides TMGMTDefaultTranslatorPluginController::getSupportedTargetLanguages().

File

./tmgmt_google.plugin.inc, line 156
Provides Google Translator plugin controller.

Class

TMGMTGoogleTranslatorPluginController
Google translator plugin controller.

Code

public function getSupportedRemoteLanguages(TMGMTTranslator $translator) {
  $languages = array();
  try {
    $request = $this
      ->doRequest($translator, 'languages');
    foreach ($request['data']['languages'] as $language) {
      $languages[$language['language']] = $language['language'];
    }
  } catch (TMGMTGoogleException $e) {
    watchdog_exception('tmgmt', $e);
    drupal_set_message(t('Unable to retrieve a list of available languages.'), 'error');
  }
  return $languages;
}