public function LanguageLocaleMapper::getConfigurableLanguageForLocale in Lingotek Translation 8
Same name and namespace in other branches
- 8.2 src/LanguageLocaleMapper.php \Drupal\lingotek\LanguageLocaleMapper::getConfigurableLanguageForLocale()
- 4.0.x src/LanguageLocaleMapper.php \Drupal\lingotek\LanguageLocaleMapper::getConfigurableLanguageForLocale()
- 3.0.x src/LanguageLocaleMapper.php \Drupal\lingotek\LanguageLocaleMapper::getConfigurableLanguageForLocale()
- 3.1.x src/LanguageLocaleMapper.php \Drupal\lingotek\LanguageLocaleMapper::getConfigurableLanguageForLocale()
- 3.2.x src/LanguageLocaleMapper.php \Drupal\lingotek\LanguageLocaleMapper::getConfigurableLanguageForLocale()
- 3.3.x src/LanguageLocaleMapper.php \Drupal\lingotek\LanguageLocaleMapper::getConfigurableLanguageForLocale()
- 3.4.x src/LanguageLocaleMapper.php \Drupal\lingotek\LanguageLocaleMapper::getConfigurableLanguageForLocale()
- 3.5.x src/LanguageLocaleMapper.php \Drupal\lingotek\LanguageLocaleMapper::getConfigurableLanguageForLocale()
- 3.6.x src/LanguageLocaleMapper.php \Drupal\lingotek\LanguageLocaleMapper::getConfigurableLanguageForLocale()
- 3.7.x src/LanguageLocaleMapper.php \Drupal\lingotek\LanguageLocaleMapper::getConfigurableLanguageForLocale()
- 3.8.x src/LanguageLocaleMapper.php \Drupal\lingotek\LanguageLocaleMapper::getConfigurableLanguageForLocale()
Gets the Drupal language for the given Lingotek locale.
Parameters
string $locale: The Lingotek locale.
Return value
ConfigurableLanguageInterface|NULL The Drupal language created for this locale, or NULL if there is none.
Overrides LanguageLocaleMapperInterface::getConfigurableLanguageForLocale
File
- src/
LanguageLocaleMapper.php, line 33
Class
Namespace
Drupal\lingotekCode
public function getConfigurableLanguageForLocale($locale) {
$drupal_language = NULL;
$locale = str_replace("-", "_", $locale);
$id = $this->entityQuery
->get('configurable_language')
->condition('third_party_settings.lingotek.locale', $locale)
->execute();
if (!empty($id)) {
$drupal_language = ConfigurableLanguage::load(reset($id));
}
else {
$drupal_language = ConfigurableLanguage::load(LingotekLocale::convertLingotek2Drupal($locale));
}
return $drupal_language;
}