public static function LingotekLocale::getLanguages in Lingotek Translation 3.7.x
Same name and namespace in other branches
- 8 src/LingotekLocale.php \Drupal\lingotek\LingotekLocale::getLanguages()
- 8.2 src/LingotekLocale.php \Drupal\lingotek\LingotekLocale::getLanguages()
- 4.0.x src/LingotekLocale.php \Drupal\lingotek\LingotekLocale::getLanguages()
- 3.0.x src/LingotekLocale.php \Drupal\lingotek\LingotekLocale::getLanguages()
- 3.1.x src/LingotekLocale.php \Drupal\lingotek\LingotekLocale::getLanguages()
- 3.2.x src/LingotekLocale.php \Drupal\lingotek\LingotekLocale::getLanguages()
- 3.3.x src/LingotekLocale.php \Drupal\lingotek\LingotekLocale::getLanguages()
- 3.4.x src/LingotekLocale.php \Drupal\lingotek\LingotekLocale::getLanguages()
- 3.5.x src/LingotekLocale.php \Drupal\lingotek\LingotekLocale::getLanguages()
- 3.6.x src/LingotekLocale.php \Drupal\lingotek\LingotekLocale::getLanguages()
- 3.8.x src/LingotekLocale.php \Drupal\lingotek\LingotekLocale::getLanguages()
Gets the site's available target languages for Lingotek translation.
Parameters
mixed $pluck_field: NULL - return the entire object string - return an array of just the pluck_field specified (if it exists) array - return an array of the selected fields
Return value
array An array of Lingotek language codes.
2 calls to LingotekLocale::getLanguages()
File
- src/
LingotekLocale.php, line 357
Class
- LingotekLocale
- A utility class for Lingotek translation.
Namespace
Drupal\lingotekCode
public static function getLanguages($pluck_field = NULL, $include_disabled = FALSE, $lingotek_locale_to_exclude = NULL) {
// lingotek_add_missing_locales(FALSE);
$languages = [];
foreach (\Drupal::languageManager()
->getLanguages() as $target_language) {
if ($target_language->lingotek_locale == $lingotek_locale_to_exclude) {
continue;
}
$language = is_string($pluck_field) && isset($target_language->{$pluck_field}) ? $target_language->{$pluck_field} : $target_language;
// include all languages enabled
if ($target_language->lingotek_enabled) {
$languages[$target_language->lingotek_locale] = $language;
// include all languages, including disabled (lingotek_enabled is 0)
}
elseif ($include_disabled) {
$languages[$target_language->lingotek_locale] = $language;
}
}
return $languages;
}