XliffUtils
in package
Provides some utility methods for XLIFF translation files, such as validating their contents according to the XSD schema.
Tags
Table of Contents
- getErrorsAsString() : string
- getVersionNumber() : string
- Gets xliff file version based on the root "version" attribute.
- validateSchema() : array<string|int, mixed>
- Validates and parses the given file into a DOMDocument.
- fixXmlLocation() : string
- Internally changes the URI of a dependent xsd to be loaded locally.
- getSchema() : string
- getXmlErrors() : array<string|int, mixed>
- Returns the XML errors of the internal XML parser.
Methods
getErrorsAsString()
public
static getErrorsAsString(array<string|int, mixed> $xmlErrors) : string
Parameters
- $xmlErrors : array<string|int, mixed>
Return values
string —getVersionNumber()
Gets xliff file version based on the root "version" attribute.
public
static getVersionNumber(DOMDocument $dom) : string
Defaults to 1.2 for backwards compatibility.
Parameters
- $dom : DOMDocument
Tags
Return values
string —validateSchema()
Validates and parses the given file into a DOMDocument.
public
static validateSchema(DOMDocument $dom) : array<string|int, mixed>
Parameters
- $dom : DOMDocument
Tags
Return values
array<string|int, mixed> —fixXmlLocation()
Internally changes the URI of a dependent xsd to be loaded locally.
private
static fixXmlLocation(string $schemaSource, string $xmlUri) : string
Parameters
- $schemaSource : string
- $xmlUri : string
Return values
string —getSchema()
private
static getSchema(string $xliffVersion) : string
Parameters
- $xliffVersion : string
Return values
string —getXmlErrors()
Returns the XML errors of the internal XML parser.
private
static getXmlErrors(bool $internalErrors) : array<string|int, mixed>
Parameters
- $internalErrors : bool