public function TMGMTFileTranslatorPluginController::requestTranslation in Translation Management Tool 7
@abstract
Submits the translation request and sends it to the translation provider.
Parameters
TMGMTJob $job: The job that should be submitted.
Overrides TMGMTTranslatorPluginControllerInterface::requestTranslation
File
- translators/
file/ tmgmt_file.plugin.inc, line 24 - Provides the file translator plugin controller.
Class
- TMGMTFileTranslatorPluginController
- File translator plugin controller.
Code
public function requestTranslation(TMGMTJob $job) {
$name = "JobID" . $job->tjid . '_' . $job->source_language . '_' . $job->target_language;
$export = tmgmt_file_format_controller($job
->getSetting('export_format'));
$path = $job
->getSetting('scheme') . '://tmgmt_file/' . $name . '.' . $job
->getSetting('export_format');
$dirname = dirname($path);
if (file_prepare_directory($dirname, FILE_CREATE_DIRECTORY)) {
$file = file_save_data($export
->export($job), $path);
file_usage_add($file, 'tmgmt_file', 'tmgmt_job', $job->tjid);
$job
->submitted('Exported file can be downloaded <a href="!link">here</a>.', array(
'!link' => file_create_url($file->uri),
));
}
}