protected function ConfigImportLocaleSubscriber::saveCustomizedTranslation in Locale: Config import 8
Saves a translation string and marks it as customized.
We overwrite this function to make sure it checks the overwrite_interface_translation setting of this module.
Overrides LocaleConfigSubscriber::saveCustomizedTranslation
File
- src/
ConfigImportLocaleSubscriber.php, line 23
Class
- ConfigImportLocaleSubscriber
- This class extends the LocaleConfigSubscriber in Drupal\locale.
Namespace
Drupal\config_import_localeCode
protected function saveCustomizedTranslation($name, $source, $context, $new_translation, $langcode) {
// Load our config.
$config_import_locale_config = \Drupal::config('config_import_locale.settings');
$overwrite = $config_import_locale_config
->get('overwrite_interface_translation');
// Call the correct function, based on our config.
switch ($overwrite) {
case 'no_overwrite':
$this
->saveCustomizedTranslationNoOverwrite($name, $source, $context, $new_translation, $langcode);
break;
case 'nothing':
// Do nothing.
break;
default:
parent::saveCustomizedTranslation($name, $source, $context, $new_translation, $langcode);
}
}