protected LocaleConfigSubscriber::processTranslatableData($name, array $config, array $translatable, $langcode, array $reference_config = array())
Process the translatable data array with a given language.
Parameters
string $name: The configuration name.
array $config: The active configuration data or override data.
array|\Drupal\Core\StringTranslation\TranslatableMarkup[] $translatable: The translatable array structure. @see \Drupal\locale\LocaleConfigManager::getTranslatableData()
string $langcode: The language code to process the array with.
array $reference_config: (Optional) Reference configuration to check against if $config was an override. This allows us to update locale keys for data not in the override but still in the active configuration.
File
- core/modules/locale/src/LocaleConfigSubscriber.php, line 142
Class
- LocaleConfigSubscriber
- Updates strings translation when configuration translations change.
Namespace
Drupal\locale
Code
protected function processTranslatableData($name, array $config, array $translatable, $langcode, array $reference_config = array()) { foreach ($translatable as $key => $item) { if (!isset($config[$key])) { if (isset($reference_config[$key])) { $this->resetExistingTranslations($name, $translatable[$key], $reference_config[$key], $langcode); } continue; } if (is_array($item)) { $reference_config = isset($reference_config[$key]) ? $reference_config[$key] : array(); $this->processTranslatableData($name, $config[$key], $item, $langcode, $reference_config); } else { $this->saveCustomizedTranslation($name, $item->getUntranslatedString(), $item->getOption('context'), $config[$key], $langcode); } } }
Please login to continue.