function LocaleProjectChecker::triggerBatch
Same name and namespace in other branches
- 11.x core/modules/locale/src/LocaleProjectChecker.php \Drupal\locale\LocaleProjectChecker::triggerBatch()
Builds a batch to get the status of remote and local translation files.
The batch process fetches the state of both local and (if configured) remote translation files. The data of the most recent translation is stored per project and per language. The data for this is maintained by \Drupal\locale\LocaleSource.
Parameters
array $projects: Array of project names for which to check the state of translation files. Defaults to all translatable projects.
array $langcodes: Array of language codes. Defaults to all translatable languages.
1 call to LocaleProjectChecker::triggerBatch()
- LocaleProjectChecker::checkProjects in core/
modules/ locale/ src/ LocaleProjectChecker.php - Check for the latest release of project translations.
File
-
core/
modules/ locale/ src/ LocaleProjectChecker.php, line 107
Class
- LocaleProjectChecker
- Provide Locale Project Checker helper methods.
Namespace
Drupal\localeCode
public function triggerBatch(array $projects, array $langcodes = []) : void {
$langcodes = $langcodes ?: array_keys(locale_translatable_language_list());
$options = LocaleDefaultOptions::updateOptions();
$operations = $this->localeFetch
->getStatusOperations($projects, $langcodes, $options);
$batch_builder = (new BatchBuilder())->setTitle($this->t('Checking translations'))
->setErrorMessage($this->t('Error checking translation updates.'))
->setFinishCallback(self::class . ':batchFinished');
foreach ($operations as $operation) {
$batch_builder->addOperation(...$operation);
}
batch_set($batch_builder->toArray());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.