QuickNav
SampleFileDownloader
new SampleFileDownloader()
Download all the translated files.
This involves downloading each file, merging the translated strings with the original file and creating a new file under the locale folder for the file.
This involves downloading each file, merging the translated strings with the original file and creating a new file under the locale folder for the file.
Methods
downloadFile(jobConfig, jobId, file, fileType, sourceLanguage, targetLanguages) → {Promise}
Download the translated file from the Language Service Provider.
- For each target language:
- Download the translation for the targeted language.
- Merge the translation with the original file.
- Save the combined file under a folder named for the targeted locale.
- If the file is a binary file, then download the translated binary file to a folder named for the targeted locale.
Parameters:
Name | Type | Description |
---|---|---|
jobConfig |
SampleJobManager.JobConfig | The configuration of the connector job to run. This information is held as metadata in the connector for the job. |
jobId |
string | The job identifier that contains this file. |
file |
SampleJobManager.file | Details on the site or assets file to import. |
fileType |
'site' | 'assets' | The type of file being imported. |
sourceLanguage |
string | The source language for the file. |
targetLanguages |
Array.<string> | Array of target languages for the file. |
Returns:
A Promise that is resolved when all translations have been received.
- Type
- Promise
downloadFileList(fileType, file) → {Array.<function()>}
Create an array of Promises to download all the translations for all the files in the file list
The promises are chained in a "return p1.then(return p2.then(return p3.then(...)))"" model to avoid overloading the Language Service Provider.
The promises are chained in a "return p1.then(return p2.then(return p3.then(...)))"" model to avoid overloading the Language Service Provider.
Parameters:
Name | Type | Description |
---|---|---|
fileType |
'site' | 'assets' | The type of file being downloaded. |
file |
SampleJobManager.file | Details on the site or assets file to download. |
Returns:
An array of functions, each of which returns a promise that resolves when all the translations for the file are downloaded.
- Type
- Array.<function()>
downloadFiles(jobConfig, jobDetails) → {Promise}
Download all the translations for all the Site & Assets files into the Language Service Provider for this job
The promises are chained in a "return p1.then(return p2.then(return p3.then(...)))"" model to avoid overloading the Language Service Provider.
The promises are chained in a "return p1.then(return p2.then(return p3.then(...)))"" model to avoid overloading the Language Service Provider.
Parameters:
Name | Type | Description |
---|---|---|
jobConfig |
SampleJobManager.JobConfig | The configuration of the connector job to run. This information is held as metadata in the connector for the job. |
jobDetails |
SampleJobManager.JobDetails | The details of the combined job.json files. |
Returns:
A Promise that resolves when all files have been downloaded.
- Type
- Promise