QuickNav
SampleFileTranslator
new SampleFileTranslator()
Request the Language Service Provider translates all Assets & Site files into the requested target languages.
The steps involved are:
The steps involved are:
- For each site & assets file:
- For each target locale:
- Translate the document into the target locale
- For each target locale:
Methods
translateFile(jobConfig, jobDetails, fileType, file, locale) → {Promise}
Request the Language Service Provider to translate a file into the given target 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. |
jobDetails |
SampleJobManager.JobDetails | The details of the combined job.json files. |
fileType |
'site' | 'assets' | The type of file being imported |
file |
SampleJobManager.file | Details on the site or assets file to import |
locale |
string | The target locale for the translation. |
Returns:
A Promise that is resolved when the translation request has been accepted by the Language Service Provider.
- Type
- Promise
translateFiles(jobConfig, jobDetails) → {Promise}
Translate 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 translated.
- Type
- Promise
translateFileToLocales(jobConfig, jobDetails, fileType, file) → {Array.<function()>}
Translate all the files in the file list
Loop through each file in the file list then:
Loop through each of the target locales and translate the file into the target locale
Loop through each file in the file list then:
Loop through each of the target locales and translate the file into the target 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. |
jobDetails |
SampleJobManager.JobDetails | The details of the combined job.json files. |
fileType |
'site' | 'assets' | The type of file being imported |
file |
SampleJobManager.file | Details on the site or assets file to import |
Returns:
An array of functions, each of which returns a promise that resolves when the file is translated.
- Type
- Array.<function()>