You are here

public function Lingotek::getLocales in Lingotek Translation 3.4.x

Same name and namespace in other branches
  1. 8 src/Lingotek.php \Drupal\lingotek\Lingotek::getLocales()
  2. 8.2 src/Lingotek.php \Drupal\lingotek\Lingotek::getLocales()
  3. 4.0.x src/Lingotek.php \Drupal\lingotek\Lingotek::getLocales()
  4. 3.0.x src/Lingotek.php \Drupal\lingotek\Lingotek::getLocales()
  5. 3.1.x src/Lingotek.php \Drupal\lingotek\Lingotek::getLocales()
  6. 3.2.x src/Lingotek.php \Drupal\lingotek\Lingotek::getLocales()
  7. 3.3.x src/Lingotek.php \Drupal\lingotek\Lingotek::getLocales()
  8. 3.5.x src/Lingotek.php \Drupal\lingotek\Lingotek::getLocales()
  9. 3.6.x src/Lingotek.php \Drupal\lingotek\Lingotek::getLocales()
  10. 3.7.x src/Lingotek.php \Drupal\lingotek\Lingotek::getLocales()
  11. 3.8.x src/Lingotek.php \Drupal\lingotek\Lingotek::getLocales()

Get the available locales on Lingotek.

Return value

array Array of locales (as in de-DE, es-ES). Empty array if there is an error.

Overrides LingotekInterface::getLocales

File

src/Lingotek.php, line 615

Class

Lingotek
The connecting class between Drupal and Lingotek

Namespace

Drupal\lingotek

Code

public function getLocales() {
  $data = $this->api
    ->getLocales();
  $locales = [];
  if ($data) {
    foreach ($data['entities'] as $locale) {
      $locales[] = $locale['properties']['code'];
    }
  }
  return $locales;
}