You are here

public function LingotekFake::getLocalesInfo in Lingotek Translation 3.1.x

Same name and namespace in other branches
  1. 8.2 tests/modules/lingotek_test/src/LingotekFake.php \Drupal\lingotek_test\LingotekFake::getLocalesInfo()
  2. 4.0.x tests/modules/lingotek_test/src/LingotekFake.php \Drupal\lingotek_test\LingotekFake::getLocalesInfo()
  3. 3.0.x tests/modules/lingotek_test/src/LingotekFake.php \Drupal\lingotek_test\LingotekFake::getLocalesInfo()
  4. 3.2.x tests/modules/lingotek_test/src/LingotekFake.php \Drupal\lingotek_test\LingotekFake::getLocalesInfo()
  5. 3.3.x tests/modules/lingotek_test/src/LingotekFake.php \Drupal\lingotek_test\LingotekFake::getLocalesInfo()
  6. 3.4.x tests/modules/lingotek_test/src/LingotekFake.php \Drupal\lingotek_test\LingotekFake::getLocalesInfo()
  7. 3.5.x tests/modules/lingotek_test/src/LingotekFake.php \Drupal\lingotek_test\LingotekFake::getLocalesInfo()
  8. 3.6.x tests/modules/lingotek_test/src/LingotekFake.php \Drupal\lingotek_test\LingotekFake::getLocalesInfo()
  9. 3.7.x tests/modules/lingotek_test/src/LingotekFake.php \Drupal\lingotek_test\LingotekFake::getLocalesInfo()
  10. 3.8.x tests/modules/lingotek_test/src/LingotekFake.php \Drupal\lingotek_test\LingotekFake::getLocalesInfo()

Get the available locales on Lingotek with extra information.

Return value

array Array of locales. Empty array if there is an error. The array has the locale as key, and the value is a nested array with the following keys: code, language_code, title, language, country_code, and country.

Overrides LingotekInterface::getLocalesInfo

File

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

Class

LingotekFake

Namespace

Drupal\lingotek_test

Code

public function getLocalesInfo() {
  if (\Drupal::state()
    ->get('lingotek.locales_error', FALSE)) {
    throw new LingotekApiException('{"messages":["HTTP 401 Unauthorized"]}', 401);
  }
  return [
    'es-ES' => [
      'code' => 'es-ES',
      'language_code' => 'ES',
      'title' => 'Spanish (Spain)',
      'language' => 'Spanish',
      'country_code' => 'ES',
      'country' => 'Spain',
    ],
    'de-AT' => [
      'code' => 'de-AT',
      'language_code' => 'DE',
      'title' => 'German (Austria)',
      'language' => 'German',
      'country_code' => 'AT',
      'country' => 'Austria',
    ],
    'de-DE' => [
      'code' => 'de-DE',
      'language_code' => 'DE',
      'title' => 'German (Germany)',
      'language' => 'German',
      'country_code' => 'DE',
      'country' => 'Germany',
    ],
  ];
}