function LocaleProjectChecker::batchFinished
Same name and namespace in other branches
- 11.x core/modules/locale/src/LocaleProjectChecker.php \Drupal\locale\LocaleProjectChecker::batchFinished()
Implements callback_batch_finished().
Set result message.
Parameters
bool $success: TRUE if batch successfully completed.
array $results: Batch results.
File
-
core/
modules/ locale/ src/ LocaleProjectChecker.php, line 135
Class
- LocaleProjectChecker
- Provide Locale Project Checker helper methods.
Namespace
Drupal\localeCode
public function batchFinished(bool $success, array $results) : void {
if ($success) {
if (isset($results['failed_files'])) {
if ($this->moduleHandler
->moduleExists('dblog') && $this->currentUser
->hasPermission('access site reports')) {
$message = $this->translationManager
->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 = $this->translationManager
->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.');
}
$this->messenger
->addError($message);
}
if (isset($results['files'])) {
$this->messenger
->addStatus($this->translationManager
->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'])) {
$this->messenger
->addStatus($this->t('Nothing to check.'));
}
$this->state
->set('locale.translation_last_checked', $this->time
->getRequestTime());
}
else {
$this->messenger
->addError($this->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.