Job
Jobs - a way to run long-running tasks in the background. Jobs are used to run tasks that take a long time to complete, such as syncing data between Crowdin and a third-party service.
Currently, it can be used in the updateCrowdin and updateCrowdin functions of the Project Integration app.
The Job object has the following properties:
type- the type of the job (cron,manual,rerun).
Functions
Section titled “Functions”update
Section titled “update”Function to update the job status. It accepts an object with the following fields:
progress- the progress of the job (0-100).status- the status of the job (in_progress,finished,failed,canceled).info- additional information about the job.data- additional data about the job.
fetchTranslation
Section titled “fetchTranslation”Function to fetch a translation for a specific file and language. It accepts an object with the following fields:
fileId- the ID of the file.languageId- the ID of the language.params- (optional) additional parameters for building the translation (e.g.,skipUntranslatedStrings,exportApprovedOnly, etc.).
translationUploaded
Section titled “translationUploaded”Use this function to notify Crowdin that a translation has been uploaded. It accepts an object with the following fields:
fileId- the ID of the file.translationParams- an array of objects with the following fields:languageId- the ID of the language.etag- the etag of the translation.
Persistence
Section titled “Persistence”By default, job executor preserves information about files in database but for large projects with large number of languages and files this could be a bottleneck.
As an alternative, job executor could be configured to store this in memory. But as a consequence it will lose this during redeploys and drawback of this is extra requests for translations.
To activate in memory store, provide jobStoreType for the projectIntegration setup.
projectIntegration.jobStoreType = 'in-memory';Read more in the Upload Only New Translations section.
markFilesAsUnsynced
Section titled “markFilesAsUnsynced”Function to mark files as unsynced. It accepts an object with the following field:
fileIds- An array of file IDs that should be marked as unsynced.
Read more in the Unsynced Files section.