class Translation extends Package

Class Translation

Methods

__construct(string $projectId, string $apiKey, Client $httpClient)

Constructor.

from Package
string
getProjectId()

Get the project ID.

from Package
string
getApiKey()

Get the API key.

from Package
Client
getHttpClient()

Get the HTTP client object.

from Package
string
getBasePath(string $action)

Get the base path for the command including an action.

from Package
ResponseInterface
upload(Languagefile $languagefile, string $language, bool $importDuplicates = false, bool $importEqualSuggestions = false, bool $autoImproveImports = false)

Upload existing translations to your Crowdin project.

ResponseInterface
export(string $branch = '')

Build ZIP archive with the latest translations. Please note that this method can be invoked only once per 30 minutes (there is no such restriction for organization plans). Also API call will be ignored if there were no changes in the project since previous export. You can see whether ZIP archive with latest translations was actually build by status attribute ("built" or "skipped") returned in response.

ResponseInterface
download(string $package, string $toPath, string $branch = '')

Download ZIP file with translations. You can choose the language of translation you need or download all of them at once.

ResponseInterface
getStatus()

Track overall translation and proofreading progresses of each target language.

Details

in Package at line 45
__construct(string $projectId, string $apiKey, Client $httpClient)

Constructor.

Parameters

string $projectId The project ID.
string $apiKey The API key
Client $httpClient The HTTP client object.

in Package at line 57
protected string getProjectId()

Get the project ID.

Return Value

string

in Package at line 67
protected string getApiKey()

Get the API key.

Return Value

string

in Package at line 77
protected Client getHttpClient()

Get the HTTP client object.

Return Value

Client

in Package at line 89
protected string getBasePath(string $action)

Get the base path for the command including an action.

Parameters

string $action The action to perform.

Return Value

string

at line 44
ResponseInterface upload(Languagefile $languagefile, string $language, bool $importDuplicates = false, bool $importEqualSuggestions = false, bool $autoImproveImports = false)

Upload existing translations to your Crowdin project.

Parameters

Languagefile $languagefile The translation object.
string $language The language tag.
bool $importDuplicates Defines whether to add translation if there is the same translation previously added. Acceptable values are: 0 or 1. Default is 0.
bool $importEqualSuggestions Defines whether to add translation if it is equal to source string at Crowdin. Acceptable values are: 0 or 1. Default is 0.
bool $autoImproveImports Mark uploaded translations as approved. Acceptable values are: 0 or 1. Default is 0.

Return Value

ResponseInterface

See also

https://crowdin.com/page/api/upload-translation

at line 93
ResponseInterface export(string $branch = '')

Build ZIP archive with the latest translations. Please note that this method can be invoked only once per 30 minutes (there is no such restriction for organization plans). Also API call will be ignored if there were no changes in the project since previous export. You can see whether ZIP archive with latest translations was actually build by status attribute ("built" or "skipped") returned in response.

Parameters

string $branch The name of related version branch.

Return Value

ResponseInterface

See also

https://crowdin.com/page/api/export

at line 121
ResponseInterface download(string $package, string $toPath, string $branch = '')

Download ZIP file with translations. You can choose the language of translation you need or download all of them at once.

Note: If you would like to download the most recent translations you may want to use export API method before downloading.

Parameters

string $package Language code or "all" to download a bundle with translations to all languages.
string $toPath Local path where to download the translation package.
string $branch The name of related version branch.

Return Value

ResponseInterface

See also

https://crowdin.com/page/api/download

at line 148
ResponseInterface getStatus()

Track overall translation and proofreading progresses of each target language.

Default response format is XML.

Return Value

ResponseInterface

See also

https://crowdin.com/page/api/status