// Add predefined language.
$this->
drupalGet('admin/config/regional/language/add'
);
$this->
submitForm(['predefined_langcode' => 'af'
], 'Add language'
);
$override = \Drupal::
languageManager()->
getLanguageConfigOverride('af', 'locale_test_translate.settings'
);
$this->
assertEquals(['translatable_default_with_translation' => 'Locale can translate Afrikaans'
],
$override->
get());
// Remove the string from translation to simulate a Locale removal. Note
// that is no current way of doing this in the UI.
$locale_storage = \Drupal::
service('locale.storage'
);
$string =
$locale_storage->
findString(['source' => 'Locale can translate'
]);
\Drupal::
service('locale.storage'
)->
delete($string);
// Force a rebuild of config translations.
$count = Locale::
config()->
updateConfigTranslations(['locale_test_translate.settings'
],
['af'
]);
$this->
assertEquals(1,
$count, 'Correct count of updated translations'
);
$override = \Drupal::
languageManager()->
getLanguageConfigOverride('af', 'locale_test_translate.settings'
);
$this->
assertEquals([],
$override->
get());
$this->
assertTrue($override->
isNew(), 'The configuration override was deleted when the Locale string was deleted.'
);
} /**
* Tests removing a string from Locale changes configuration translations.
*/