Have you ever been in the situation where you had to add [a few] translations on a hook_update instead of importing them from a .po file?
It happened to me several times where I wanted them to be added as part of the database updates, so I found out I could do it using _locale_import_one_string_db().
Note: you will need Locale module enabled and the language in which you want to translate the strings added to your site (/admin/config/regional/language). In this example, we are using Spanish as the second language:
/**
* Implements hook_update_N().
*/
function my_module_update_7002() {
// Define some defaults.
$report = array('additions' => 0, 'updates' => 0, 'deletes' => 0, 'skips' => 0);
// Define the original text.
$msgid = 'I want this to be translated';
// Set the string in the other language.
$msgstr_es = 'Quiero que esto sea traducido';
// Finally, translate it.
_locale_import_one_string_db($report, 'es', '', $msgid, $msgstr_es, 'default', '', 'LOCALE_IMPORT_KEEP');
}
Notice that I'm using LOCALE_IMPORT_KEEP to keep existing translations, but you could change this to LOCALE_IMPORT_OVERWRITE if you want to overwrite them.
So now go ahead and run the updates to see your string translated (/admin/config/regional/translate/translate).