public function Lingotek::getLocalesInfo in Lingotek Translation 8.2
Same name and namespace in other branches
- 4.0.x src/Lingotek.php \Drupal\lingotek\Lingotek::getLocalesInfo()
- 3.0.x src/Lingotek.php \Drupal\lingotek\Lingotek::getLocalesInfo()
- 3.1.x src/Lingotek.php \Drupal\lingotek\Lingotek::getLocalesInfo()
- 3.2.x src/Lingotek.php \Drupal\lingotek\Lingotek::getLocalesInfo()
- 3.3.x src/Lingotek.php \Drupal\lingotek\Lingotek::getLocalesInfo()
- 3.4.x src/Lingotek.php \Drupal\lingotek\Lingotek::getLocalesInfo()
- 3.5.x src/Lingotek.php \Drupal\lingotek\Lingotek::getLocalesInfo()
- 3.6.x src/Lingotek.php \Drupal\lingotek\Lingotek::getLocalesInfo()
- 3.7.x src/Lingotek.php \Drupal\lingotek\Lingotek::getLocalesInfo()
- 3.8.x src/Lingotek.php \Drupal\lingotek\Lingotek::getLocalesInfo()
Get the available locales on Lingotek.
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
- src/
Lingotek.php, line 514
Class
- Lingotek
- The connecting class between Drupal and Lingotek
Namespace
Drupal\lingotekCode
public function getLocalesInfo() {
$data = $this->api
->getLocales();
$locales = [];
if ($data) {
foreach ($data['entities'] as $locale) {
$languageCode = $locale['properties']['language_code'];
$countryCode = $locale['properties']['country_code'];
$title = $locale['properties']['title'];
$language = $locale['properties']['language'];
$country = $locale['properties']['country'];
$code = $locale['properties']['code'];
$locales[$code] = [
'code' => $code,
'language_code' => $languageCode,
'title' => $title,
'language' => $language,
'country_code' => $countryCode,
'country' => $country,
];
}
}
return $locales;
}