Development helper for translation management
When developing a multilingual site you might want to add new translatable strings and their translations in an update or install hook.
This module adds a service that can help you with that:
function hook_update_N(&$sandbox) {
$tt = \Drupal::service('translate_tool');
$tt->add('horse', 'da', 'hest');
$tt->delete('horse');'
}
Or if you prefer a procedural interface (update and install hooks are procedural anyway):