You are here

public function FileApi::import in TMGMT Translator Smartling 8.2

Same name in this branch
  1. 8.2 api-sdk-php/src/File/FileApi.php \Smartling\File\FileApi::import()
  2. 8.2 vendor/smartling/api-sdk-php/src/File/FileApi.php \Smartling\File\FileApi::import()
Same name and namespace in other branches
  1. 8.4 vendor/smartling/api-sdk-php/src/File/FileApi.php \Smartling\File\FileApi::import()
  2. 8.3 vendor/smartling/api-sdk-php/src/File/FileApi.php \Smartling\File\FileApi::import()

Import files form Service.

Parameters

string $locale: The Smartling locale identifier for the language Smartling is importing.

string $fileUri: The Smartling URI for file that contains the original language strings already uploaded to Smartling.

string $fileType: The type of file used for imports. Valid values are: ios, android, gettext, javaProperties, xml, json, yaml, and csv.

string $fileRealPath: Absolute path to the file on your local machine that contains the translated content,

string $translationState: Value indicating the workflow state to import the translations into. Content will be imported into the language's default workflow. Could be 'PUBLISHED' or 'POST_TRANSLATION'.

boolean $overwrite: (optional) An associative array of additional options, with the following elements:

  • 'overwrite': Boolean indicating whether or not to overwrite existing translations.

Return value

string

Throws

\Smartling\Exceptions\SmartlingApiException

See also

http://docs.smartling.com/pages/API/Translation-Imports/

File

api-sdk-php/src/File/FileApi.php, line 385

Class

FileApi
Class FileApi

Namespace

Smartling\File

Code

public function import($locale, $fileUri, $fileType, $fileRealPath, $translationState, $overwrite = false) {
  $params['fileUri'] = $fileUri;
  $params['fileType'] = $fileType;
  $params['file'] = $fileRealPath;
  $params['translationState'] = $translationState;
  $params['overwrite'] = $overwrite;
  $requestData = $this
    ->getDefaultRequestData('multipart', $params);
  return $this
    ->sendRequest("/locales/{$locale}/file/import", $requestData, self::HTTP_METHOD_POST);
}