XliffParser
class \
- Extends
- AbstractXmlParser
Parser for XLIFF file.
Deprecated
will be removed in TYPO3 v15.0. Switch to Symfony Translation loaders.
Internal
This class is a concrete implementation and is not part of the TYPO3 Core API.
Table of Contents
Properties
- $languageKey : string
- $sourcePath : string
Methods
- __construct() : mixed
- getParsedData() : array
- Returns parsed representation of XML file.
- parseExtensionResource() : array
- New method for parsing xml files, not part of an interface as the plan is to replace the entire API for labels with something different in TYPO3 12
- _getParsedData() : array
- Actually doing all the work of parsing an XML file
- doParsingFromRoot() : array
- Returns array representation of XML data, starting from a root node.
- getLocalizedFileName() : string
- Checks if a localized file is found in labels pack (e.g. a language pack was downloaded in the backend) or if $sameLocation is set, then checks for a file located in "{language}.locallang.xlf" at the same directory
- parseXmlFile() : array
- Loads the current XML file before processing.
Properties
$languageKey
protected
string
$languageKey
$sourcePath
protected
string
$sourcePath
Methods
__construct()
public
__construct() : mixed
getParsedData()
Returns parsed representation of XML file.
public
getParsedData(string $sourcePath, string $languageKey) : array
Parameters
- $sourcePath : string
-
Source file path
- $languageKey : string
-
Language key
Tags
Return values
arrayparseExtensionResource()
New method for parsing xml files, not part of an interface as the plan is to replace the entire API for labels with something different in TYPO3 12
public
parseExtensionResource(string $sourcePath, string $languageKey, string $fileNamePattern) : array
Parameters
- $sourcePath : string
- $languageKey : string
- $fileNamePattern : string
Return values
array_getParsedData()
Actually doing all the work of parsing an XML file
protected
_getParsedData(string $sourcePath, string $languageKey, string|null $labelsPath) : array
Parameters
- $sourcePath : string
-
Source file path
- $languageKey : string
-
Language key
- $labelsPath : string|null
Tags
Return values
arraydoParsingFromRoot()
Returns array representation of XML data, starting from a root node.
protected
doParsingFromRoot(SimpleXMLElement $root) : array
Parameters
- $root : SimpleXMLElement
-
A root node
Return values
array —An array representing the parsed XML file
getLocalizedFileName()
Checks if a localized file is found in labels pack (e.g. a language pack was downloaded in the backend) or if $sameLocation is set, then checks for a file located in "{language}.locallang.xlf" at the same directory
protected
getLocalizedFileName(string $fileRef, string $language[, bool $sameLocation = false ]) : string
Parameters
- $fileRef : string
-
Absolute file reference to locallang file
- $language : string
-
Language key
- $sameLocation : bool = false
-
If TRUE, then locallang localization file name will be returned with same directory as $fileRef
Return values
string —Absolute path to the language file
parseXmlFile()
Loads the current XML file before processing.
protected
parseXmlFile() : array
Tags
Return values
array —An array representing parsed XML file (structure depends on concrete parser)