Suppose you have a Drupal 8 multi site installation, with multi language support, and a custom module used across multiple sites.
This module has a view, with the yml file in:
You also have to maintain some strings translations for this view to multiple languages (the view title among others). So for each language, you have:
You install a new site enabling the custom module, and then adding languages to the site, and the configuration languages overrides are loaded properly into
config table with
collection attribute to
But… then you update the language file, adding missing strings or editing one of existing. Replicating those translations manually into production environment is not an option, because you have dozens of sites using this module… How can you reload these strings translations in a programmatically way for preparing a
hook_update_n in the custom module, or via a drush command?
For updating configurations I'm using
config_update module, with the following approach:
$configUpdate = \Drupal::service('config_update.config_update'); // Reload existing config $configUpdate->revert('view', 'custom_view'); // Import a new config $configUpdate->import('view', 'new_view');
But for reverting translations of those configurations I haven't found any approach yet. Any idea?
Thanks in advance.