public static function LingotekLocale::getLanguages in Lingotek Translation 8
Same name and namespace in other branches
- 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.7.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
$pluck_field - mixed: 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 355 - Defines LingotekLocale class.
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 = array();
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;
if ($target_language->lingotek_enabled) {
// include all languages enabled
$languages[$target_language->lingotek_locale] = $language;
}
elseif ($include_disabled) {
// include all languages, including disabled (lingotek_enabled is 0)
$languages[$target_language->lingotek_locale] = $language;
}
}
return $languages;
}