function locale_translate_batch_import_save in Drupal 10
Same name and namespace in other branches
- 8 core/modules/locale/locale.bulk.inc \locale_translate_batch_import_save()
- 9 core/modules/locale/locale.bulk.inc \locale_translate_batch_import_save()
Implements callback_batch_operation().
Save data of imported files.
Parameters
array|\ArrayAccess $context: Contains a list of imported files.
1 string reference to 'locale_translate_batch_import_save'
- locale_translate_batch_build in core/
modules/ locale/ locale.bulk.inc - Build a locale batch from an array of files.
File
- core/
modules/ locale/ locale.bulk.inc, line 276 - Mass import-export and batch import functionality for Gettext .po files.
Code
function locale_translate_batch_import_save($context) {
if (isset($context['results']['files'])) {
$request_time = \Drupal::time()
->getRequestTime();
foreach ($context['results']['files'] as $file) {
// Update the file history if both project and version are known. This
// table is used by the automated translation update function which tracks
// translation status of module and themes in the system. Other
// translation files are not tracked and are therefore not stored in this
// table.
if ($file->project && $file->version) {
$file->last_checked = $request_time;
locale_translation_update_file_history($file);
}
}
$context['message'] = t('Translations imported.');
}
}