function LocaleConfigManager::hasTranslation

Same name in other branches
  1. 8.9.x core/modules/locale/src/LocaleConfigManager.php \Drupal\locale\LocaleConfigManager::hasTranslation()
  2. 10 core/modules/locale/src/LocaleConfigManager.php \Drupal\locale\LocaleConfigManager::hasTranslation()
  3. 11.x core/modules/locale/src/LocaleConfigManager.php \Drupal\locale\LocaleConfigManager::hasTranslation()

Checks whether a language has configuration translation.

Parameters

string $name: Configuration name.

string $langcode: A language code.

Return value

bool A boolean indicating if a language has configuration translations.

File

core/modules/locale/src/LocaleConfigManager.php, line 467

Class

LocaleConfigManager
Manages configuration supported in part by interface translation.

Namespace

Drupal\locale

Code

public function hasTranslation($name, $langcode) {
    $translation = $this->languageManager
        ->getLanguageConfigOverride($langcode, $name);
    return !$translation->isNew();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.