Problem/Motivation
Custom modules builder require a way to add interface translations strings to a drupal site. Programatically adding a string translation is currently fairly complicated.
Below is an example this is how to add a translation of an existing singular string.
// Find existing source string.
$string = $this->localeStorage->findString(array('source' => 'Log in'));
// Create translation for new string and save it as non-customized.
$translation = $this->localeStorage->createTranslation(array(
'lid' => $string->lid,
'language' => 'nl',
'translation' => 'Inloggen',
))->save();
Inspired by this D7 helper function by fago: http://dropbucket.org/node/323
Proposed resolution
Create an helper function to add translations of singular and plural string translations of existing and new source strings. The TranslationManager is a candidate for placing this method.
Remaining tasks
none
User interface changes
none
API changes
Adds a method to add a translation.
Comments