function ConfigNamesMapper::getLangcodeFromConfig
Returns the language code of a configuration object given its name.
Parameters
string $config_name: The name of the configuration object.
Return value
string The language code of the configuration object.
Overrides ConfigMapperInterface::getLangcodeFromConfig
File
- 
              core/
modules/ config_translation/ src/ ConfigNamesMapper.php, line 413  
Class
- ConfigNamesMapper
 - Configuration mapper base implementation.
 
Namespace
Drupal\config_translationCode
public function getLangcodeFromConfig($config_name) {
  // Default to English if no language code was provided in the file.
  // Although it is a best practice to include a language code, if the
  // developer did not think about a multilingual use case, we fall back
  // on assuming the file is English.
  return $this->configFactory
    ->get($config_name)
    ->get('langcode') ?: 'en';
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.