LanguagePackService

readonly class \TYPO3\CMS\Core\Localization\LanguagePackService

Service class handling language pack details Used by 'manage language packs' module and 'language packs command'

Attributes

#[Autoconfigure]
$public: true

Table of Contents

Methods

__construct()  : mixed
getActiveLanguages()  : array<int, non-empty-string>
List of languages active in this instance
getAvailableLanguages()  : array
Get list of available languages
getExtensionLanguagePackDetails()  : array
Create a list of loaded extensions and their language packs details
getLanguageDetails()  : array
Create an array with language details: active or not, iso codes, last update, .
languagePackDownload()  : string
Download and unpack a single language pack of one extension.
setLastUpdatedIsoCode()  : void
Set 'last update' timestamp in registry for a series of iso codes.
withBatchedStateUpdates()  : T
Runs $work() while batching writes to the language pack states store into a single locked read-modify-write cycle, instead of one per languagePackDownload()/setLastUpdatedIsoCode() call made from within it. Use this when updating many language packs in one request.

Methods

__construct()

public __construct(EventDispatcherInterface $eventDispatcher, RequestFactory $requestFactory, LoggerInterface $logger, SystemResourceFactory $resourceFactory, SystemResourcePublisherInterface $resourcePublisher, Locales $locales, LanguagePackStatesStore $languagePackStatesStore) : mixed

Parameters

$eventDispatcher : EventDispatcherInterface
$requestFactory : RequestFactory
$logger : LoggerInterface
$resourceFactory : SystemResourceFactory
$resourcePublisher : SystemResourcePublisherInterface
$locales : Locales
$languagePackStatesStore : LanguagePackStatesStore

getActiveLanguages()

List of languages active in this instance

public getActiveLanguages() : array<int, non-empty-string>

Return values

array<int, non-empty-string>

getAvailableLanguages()

Get list of available languages

public getAvailableLanguages() : array

Return values

array —

iso=>name

getExtensionLanguagePackDetails()

Create a list of loaded extensions and their language packs details

public getExtensionLanguagePackDetails() : array

Return values

array

getLanguageDetails()

Create an array with language details: active or not, iso codes, last update, .

public getLanguageDetails() : array

..

Return values

array

languagePackDownload()

Download and unpack a single language pack of one extension.

public languagePackDownload(string $key, string $iso) : string

Parameters

$key : string

Extension key

$iso : string

Language iso code

Tags

throws
RuntimeException

Return values

string —

One of 'update', 'new', 'skipped' or 'failed'

setLastUpdatedIsoCode()

Set 'last update' timestamp in registry for a series of iso codes.

public setLastUpdatedIsoCode(string[] $isos) : void

Parameters

$isos : string[]

List of iso code timestamps to set

Tags

throws
RuntimeException

withBatchedStateUpdates()

Runs $work() while batching writes to the language pack states store into a single locked read-modify-write cycle, instead of one per languagePackDownload()/setLastUpdatedIsoCode() call made from within it. Use this when updating many language packs in one request.

public withBatchedStateUpdates(callable(): T $work) : T

Parameters

$work : callable(): T

Tags

template

Return values

T
On this page