src/Api/Translation.php
public function create(string $projectKey, string $localeId, string $keyId, string $content, array $params = [])
    {
        $params['locale_id'] = $localeId;
        $params['key_id'] = $keyId;
        $params['content'] = $content;

        $response = $this->httpPost(sprintf('/api/v2/projects/%s/translations', $projectKey), $params);

        if (!$this->hydrator) {
            return $response;
        }

        if ($response->getStatusCode() !== 200 && $response->getStatusCode() !== 201) {
            $this->handleErrors($response);
        }

        return $this->hydrator->hydrate($response, TranslationCreated::class);
    }
public function create(string $projectKey, string $localeId, string $keyId, string $content, array $params = [])
    {
        $params['locale_id'] = $localeId;
        $params['key_id'] = $keyId;
        $params['content'] = $content;

        $response = $this->httpPost(sprintf('/api/v2/projects/%s/translations', $projectKey), $params);

        if (!$this->hydrator) {
            return $response;
        }

        if ($response->getStatusCode() !== 200 && $response->getStatusCode() !== 201) {
            $this->handleErrors($response);
        }

        return $this->hydrator->hydrate($response, TranslationCreated::class);
    }
public function create ( string $ projectKey , string $ localeId , string $ keyId , string $ content , array $ params = [ ] ) { $ params [ 'locale_id' ] = $ localeId ; $ params [ 'key_id' ] = $ keyId ; $ params [ 'content' ] = $ content ; $ response = $ this -> httpPost ( sprintf ( '/api/v2/projects/%s/translations' , $ projectKey ) , $ params ) ; if ( ! $ this -> hydrator ) { return $ response ; } if ( $ response -> getStatusCode ( ) !== 200 && $ response -> getStatusCode ( ) !== 201 ) { $ this -> handleErrors ( $ response ) ; } return $ this -> hydrator -> hydrate ( $ response , TranslationCreated :: class ) ; }
Create a translation.

@param string $projectKey
@param string $keyId
@param string $content
@param array  $params

@return TranslationCreated|ResponseInterface
Create a translation .