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

Result
getCachedJson(Locale $locale)

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

string
getCacheVersion()

No description

array
collectPackageSources(PackageInterface $package, array $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 $value)

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

Details

Result 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

Result

Exceptions

Exception

string getCacheVersion()

No description

Return Value

string

The current cache version identifier

protected array collectPackageSources(PackageInterface $package, array $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 $sourcesToBeIncluded

optional array of wildcard-patterns to filter the sources

Return Value

array

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

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

Parameters

array $arrayPointer
string $key
string $value

Return Value

void