You are here

public function LingotekFake::getLocales in Lingotek Translation 3.3.x

Same name and namespace in other branches
  1. 8 tests/modules/lingotek_test/src/LingotekFake.php \Drupal\lingotek_test\LingotekFake::getLocales()
  2. 8.2 tests/modules/lingotek_test/src/LingotekFake.php \Drupal\lingotek_test\LingotekFake::getLocales()
  3. 4.0.x tests/modules/lingotek_test/src/LingotekFake.php \Drupal\lingotek_test\LingotekFake::getLocales()
  4. 3.0.x tests/modules/lingotek_test/src/LingotekFake.php \Drupal\lingotek_test\LingotekFake::getLocales()
  5. 3.1.x tests/modules/lingotek_test/src/LingotekFake.php \Drupal\lingotek_test\LingotekFake::getLocales()
  6. 3.2.x tests/modules/lingotek_test/src/LingotekFake.php \Drupal\lingotek_test\LingotekFake::getLocales()
  7. 3.4.x tests/modules/lingotek_test/src/LingotekFake.php \Drupal\lingotek_test\LingotekFake::getLocales()
  8. 3.5.x tests/modules/lingotek_test/src/LingotekFake.php \Drupal\lingotek_test\LingotekFake::getLocales()
  9. 3.6.x tests/modules/lingotek_test/src/LingotekFake.php \Drupal\lingotek_test\LingotekFake::getLocales()
  10. 3.7.x tests/modules/lingotek_test/src/LingotekFake.php \Drupal\lingotek_test\LingotekFake::getLocales()
  11. 3.8.x tests/modules/lingotek_test/src/LingotekFake.php \Drupal\lingotek_test\LingotekFake::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

tests/modules/lingotek_test/src/LingotekFake.php, line 370

Class

LingotekFake

Namespace

Drupal\lingotek_test

Code

public function getLocales() {
  if (\Drupal::state()
    ->get('lingotek.locales_error', FALSE)) {
    throw new LingotekApiException('{"messages":["HTTP 401 Unauthorized"]}', 401);
  }
  return [
    'es-ES',
    'de-AT',
    'de-DE',
  ];
}