public function SmartlingApi::downloadFile in TMGMT Translator Smartling 8
Downloads the requested file from Smartling.
It is important to check the HTTP response status code. If Smartling finds and returns the file normally, you will receive a 200 SUCCESS response. If you receive any other response status code than 200, the requested file will not be part of the response.
Parameters
string $fileUri: Value that uniquely identifies the downloaded file.
string $locale: A locale identifier as specified in project setup. If no locale is specified, original content is returned.
array $params: (optional) An associative array of additional options, with the following elements:
- 'retrievalType': Determines the desired format for the download. Could be one of following values: pending|published|pseudo|contextMatchingInstrumented
- 'includeOriginalStrings': Boolean that specifies whether Smartling will return the original string or an empty string where no translation is available.
Return value
string File content.
Throws
\Drupal\tmgmt_smartling\Smartling\SmartlingApiException
See also
http://docs.smartling.com/pages/API/FileAPI/Download-File/
File
- src/
Smartling/ SmartlingApi.php, line 240
Class
Namespace
Drupal\tmgmt_smartling\SmartlingCode
public function downloadFile($fileUri, $locale = '', $params = []) {
$params['fileUri'] = $fileUri;
$params['locale'] = $locale;
return $this
->sendRequest('file/get', $params, 'GET');
}