class CommunityStoreTranslationProvider implements ProviderInterface (View source)

Constants

CORE_PACKAGE_HANDLE

Properties

protected Repository $config

The configuration repository containind the default values.

protected Cache $cache

The cache to be used (won't be used if the cache lifetime is 0).

protected Client $httpClient

The HTTP client to be used to communicate with the Community Translation server.

protected string|null $entryPoint

The API entry point.

protected string|null $apiToken

The API token.

protected int|null $progressLimit

The default progress limit.

protected int|null $cacheLifetime

The cache life time (in seconds).

Methods

__construct(Repository $config, Cache $cache, Client $httpClient)

No description

$this
setEntryPoint(string $entryPoint)

Set the API entry point.

string
getEntryPoint()

Get the API entry point.

$this
setApiToken(string $value)

Set the API token.

string
getApiToken()

Get the API token.

$this
setProgressLimit($value)

Set the default progress limit.

int
getProgressLimit()

Get the default progress limit.

$this
setCacheLifetime($value)

Set the cache life time (in seconds).

int
getCacheLifetime()

Get the cache life time (in seconds).

Stats[]
getAvailableCoreStats(string $coreVersion, int|null $progressLimit = null)

List the available translations for a specific core version.

getCoreStats(string $coreVersion, string $localeID, int|null $progressLimit = null)

Get core translations stats for a specific locale ID.

Stats[]
getAvailablePackageStats(string $packageHandle, string $packageVersion, int|null $progressLimit = null)

List the available translations for a specific package version.

getPackageStats(string $packageHandle, string $packageVersion, $localeID, $progressLimit = null)

Get package translations stats for a specific locale ID.

string
fetchCoreTranslations(string $coreVersion, string $localeID, string $formatHandle = 'mo')

Fetch the translations for the concrete5 core.

string
fetchPackageTranslations(string $packageHandle, string $packageVersion, string $localeID, string $formatHandle = 'mo')

Fetch the translations for a package.

Translations
fillTranslations(Translations $translations)

Fill-in already known translations.

Request
buildRequest(string $path)

No description

array
getJsonFromResponse(Response $response)

No description

Details

__construct(Repository $config, Cache $cache, Client $httpClient)

No description

Parameters

Repository $config

The configuration repository containind the default values

Cache $cache

The cache to be used (won't be used if the cache lifetime is 0)

Client $httpClient

The HTTP client to be used to communicate with the Community Translation server

$this setEntryPoint(string $entryPoint)

Set the API entry point.

Parameters

string $entryPoint

Return Value

$this

string getEntryPoint()

Get the API entry point.

Return Value

string

$this setApiToken(string $value)

Set the API token.

Parameters

string $value

Return Value

$this

string getApiToken()

Get the API token.

Return Value

string

$this setProgressLimit($value)

Set the default progress limit.

Parameters

$value

Return Value

$this

int getProgressLimit()

Get the default progress limit.

Return Value

int

$this setCacheLifetime($value)

Set the cache life time (in seconds).

Parameters

$value

Return Value

$this

int getCacheLifetime()

Get the cache life time (in seconds).

Return Value

int

if 0, the cache is disabled

Stats[] getAvailableCoreStats(string $coreVersion, int|null $progressLimit = null)

List the available translations for a specific core version.

Parameters

string $coreVersion

The version of the concrete5 core

int|null $progressLimit

A custom progress limit (from 0 - no translations at all - to 100 - all strings are translated)

Return Value

Stats[]

Array keys are the locale IDs, values are Stats instances

See also

ProviderInterface::getAvailableCoreStats

Stats getCoreStats(string $coreVersion, string $localeID, int|null $progressLimit = null)

Get core translations stats for a specific locale ID.

Parameters

string $coreVersion

The version of the concrete5 core

string $localeID
int|null $progressLimit

A custom progress limit (from 0 - no translations at all - to 100 - all strings are translated)

Return Value

Stats

See also

ProviderInterface::getCoreStats

Stats[] getAvailablePackageStats(string $packageHandle, string $packageVersion, int|null $progressLimit = null)

List the available translations for a specific package version.

Parameters

string $packageHandle

The handle of the package

string $packageVersion

The version of the package

int|null $progressLimit

A custom progress limit (from 0 - no translations at all - to 100 - all strings are translated)

Return Value

Stats[]

Array keys are the locale IDs, values are Stats instances

See also

ProviderInterface::getAvailablePackageStats

Stats getPackageStats(string $packageHandle, string $packageVersion, $localeID, $progressLimit = null)

Get package translations stats for a specific locale ID.

Parameters

string $packageHandle

The handle of the package

string $packageVersion

The version of the package

$localeID
$progressLimit

Return Value

Stats

See also

ProviderInterface::getPackageStats

string fetchCoreTranslations(string $coreVersion, string $localeID, string $formatHandle = 'mo')

Fetch the translations for the concrete5 core.

Parameters

string $coreVersion

The version of the concrete5 core

string $localeID

The locale identifier

string $formatHandle

The handle of the format of the translations to be fetched

Return Value

string

See also

ProviderInterface::fetchCoreTranslations

string fetchPackageTranslations(string $packageHandle, string $packageVersion, string $localeID, string $formatHandle = 'mo')

Fetch the translations for a package.

Parameters

string $packageHandle

The handle of the package

string $packageVersion

The version of the package

string $localeID

The locale identifier

string $formatHandle

The handle of the format of the translations to be fetched

Return Value

string

See also

ProviderInterface::fetchPackageTranslations

Translations fillTranslations(Translations $translations)

Fill-in already known translations.

Parameters

Translations $translations

Return Value

Translations

See also

ProviderInterface::fillTranslations

protected Request buildRequest(string $path)

No description

Parameters

string $path

Return Value

Request

protected array getJsonFromResponse(Response $response)

No description

Parameters

Response $response

Return Value

array

Exceptions

Exception