class XliffService (View source)

The XLIFF service provides methods to find XLIFF files and parse them to json

Properties

protected string $xliffBasePath

A relative path for translations inside the package resources.

protected XliffReader $xliffReader
protected Service $localizationService
protected VariableFrontend $xliffToJsonTranslationsCache
protected bool $scrambleTranslatedLabels
protected array $packagesRegisteredForAutoInclusion
protected XliffFileProvider $xliffFileProvider
protected PackageManager $packageManager

Methods

string
getCachedJson(Locale $locale)

Return the json array for a given locale, sourceCatalog, xliffPath and package.

array<string,string>
getTranslationUnitValue(array $labelValue)

No description

string
getCacheVersion()

No description

array
collectPackageSources(PackageInterface $package, array<int,string> $sourcesToBeIncluded = null)

Collect all sources found in the given package as array (key = source, value = true) If sourcesToBeIncluded is an array, only those sources are returned what match the wildcard-patterns in the array-values

void
setArrayDataValue(array $arrayPointer, string $key, string|array|null $value)

Helper method to create the needed json array from a dotted xliff id

Details

string getCachedJson(Locale $locale)

Return the json array for a given locale, sourceCatalog, xliffPath and package.

The json will be cached.

Parameters

Locale $locale

The locale

Return Value

string

Exceptions

Exception
UnknownPackageException

protected array<string,string> getTranslationUnitValue(array $labelValue)

No description

Parameters

array $labelValue

Return Value

array<string,string>

string getCacheVersion()

No description

Return Value

string

The current cache version identifier

Exceptions

Exception

protected array collectPackageSources(PackageInterface $package, array<int,string> $sourcesToBeIncluded = null)

Collect all sources found in the given package as array (key = source, value = true) If sourcesToBeIncluded is an array, only those sources are returned what match the wildcard-patterns in the array-values

Parameters

PackageInterface $package
array<int,string> $sourcesToBeIncluded

optional array of wildcard-patterns to filter the sources

Return Value

array

protected void setArrayDataValue(array $arrayPointer, string $key, string|array|null $value)

Helper method to create the needed json array from a dotted xliff id

Parameters

array $arrayPointer
string $key
string|array|null $value

Return Value

void