function locale_translation_batch_status_finished
Same name in other branches
- 9 core/modules/locale/locale.batch.inc \locale_translation_batch_status_finished()
- 8.9.x core/modules/locale/locale.batch.inc \locale_translation_batch_status_finished()
- 11.x core/modules/locale/locale.batch.inc \locale_translation_batch_status_finished()
Implements callback_batch_finished().
Set result message.
Parameters
bool $success: TRUE if batch successfully completed.
array $results: Batch results.
1 string reference to 'locale_translation_batch_status_finished'
- locale_translation_batch_status_build in core/
modules/ locale/ locale.compare.inc - Builds a batch to get the status of remote and local translation files.
File
-
core/
modules/ locale/ locale.batch.inc, line 141
Code
function locale_translation_batch_status_finished($success, $results) {
if ($success) {
if (isset($results['failed_files'])) {
if (\Drupal::moduleHandler()->moduleExists('dblog') && \Drupal::currentUser()->hasPermission('access site reports')) {
$message = \Drupal::translation()->formatPlural(count($results['failed_files']), 'One translation file could not be checked. <a href=":url">See the log</a> for details.', '@count translation files could not be checked. <a href=":url">See the log</a> for details.', [
':url' => Url::fromRoute('dblog.overview')->toString(),
]);
}
else {
$message = \Drupal::translation()->formatPlural(count($results['failed_files']), 'One translation files could not be checked. See the log for details.', '@count translation files could not be checked. See the log for details.');
}
\Drupal::messenger()->addError($message);
}
if (isset($results['files'])) {
\Drupal::messenger()->addStatus(\Drupal::translation()->formatPlural(count($results['files']), 'Checked available interface translation updates for one project.', 'Checked available interface translation updates for @count projects.'));
}
if (!isset($results['failed_files']) && !isset($results['files'])) {
\Drupal::messenger()->addStatus(t('Nothing to check.'));
}
\Drupal::state()->set('locale.translation_last_checked', \Drupal::time()->getRequestTime());
}
else {
\Drupal::messenger()->addError(t('An error occurred trying to check available interface translation updates.'));
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.