- Issue created by @Flow1990
- Status changed to Needs review
over 1 year ago 2:35pm 10 May 2023 - last update
over 1 year ago 12 pass - last update
over 1 year ago 12 pass Automatically closed - issue fixed for 2 weeks with no activity.
I need to re-request translation only for Job items with STATE_ACTIVE, with continuous job. Actually, when I re-request translations, all job items
with STATE_ACCEPTED switch to STATE_ACTIVE to be translated, but this can have an impact on performance, if I have 1000 tasks already accepted, I don't want to re-request translations for all.
1. Create 2 continuous job like FR to EN and FR to DE (Don't use "Submit continuous job items on cron option"):
2. Use Deepl Translator provider plugin with "Auto accept finished translations" option, and configured with good content type to translate
3. Create node FR with EN & DE translated node
4. Two job items are created with STATE_ACTIVE in admin/tmgmt/job_items
5. Send translation request with bulk operation form like :
6. Create another node FR with EN & DE translated node and restart process
In the file : RequestTranslationTmgmtActionApproveForm.php
In formSubmit()
method, all job items are force to change to switch sate with
$item->setState(JobItem::STATE_ACTIVE);
In RequestTranslationTmgmtActionApproveForm.php
public function submitForm(array &$form, FormStateInterface $form_state) {
// Retrieve selected jobs.
$jobs = $this->getEntities($this->entityIds);
// Mark jobs as unprocessed for further processing.
foreach ($jobs as $job) {
// Requesting translation is possible only for unprocessed jobs.
// See JobCheckoutManager::checkoutMultiple() method.
$job->setState(Job::STATE_UNPROCESSED);
foreach ($job->getItems() as $item) {
// Reset statistics for the job item in order to have "count_pending"
// value not equal to "0". See Job::requestTranslation() and
// Job::getItems() methods.
if ($job->getJobType() !== 'continuous') {
$item->setState(JobItem::STATE_ACTIVE);
}
$item->resetData();
$item->recalculateStatistics();
$item->save();
}
}
// Launch TMGMT's checkout process.
$this->checkoutManager->checkoutAndRedirect($form_state, $jobs);
$this->jobQueue->setDestination('/admin/tmgmt/jobs');
}
Active
9.0
Code
Automatically closed - issue fixed for 2 weeks with no activity.