Table of Contents

Class XliffParser

Namespace
Tlumach.Base
Assembly
Tlumach.Base.dll

Parser for XLIFF 2.2 (eXtensible Localization Interchange File Format). XLIFF is a bitext format that combines source and target translations in a single file.

public class XliffParser : BaseXMLParser
Inheritance
XliffParser
Inherited Members

Properties

SegmentSeparator

Gets or sets the string used to join multiple XLIFF segments into a single translation value. Defaults to a tab character.

public string SegmentSeparator { get; set; }

Property Value

string

SourceFilename

Gets or sets the source filename to be associated with parsed translations. Used when parsing XLIFF files to track the original source file reference.

public static string? SourceFilename { get; set; }

Property Value

string

TextProcessingMode

Gets or sets the text processing mode to use when recognizing template strings in translation entries.

public static TextFormat TextProcessingMode { get; set; }

Property Value

TextFormat

Methods

CanHandleExtension(string)

Checks whether this parser can handle a translation file with the given extension.

This method is not used for configuration files.

public override bool CanHandleExtension(string fileExtension)

Parameters

fileExtension string

The extension to check.

Returns

bool

true if the extension is supported and false otherwise.

InternalLoadTranslationEntriesFromXML(XElement, CultureInfo?, Translation?, string, TextFormat?)

protected override Translation InternalLoadTranslationEntriesFromXML(XElement parentNode, CultureInfo? culture, Translation? translation, string groupName, TextFormat? textProcessingMode)

Parameters

parentNode XElement
culture CultureInfo
translation Translation
groupName string
textProcessingMode TextFormat?

Returns

Translation

InternalLoadTranslationStructure(string, TextFormat?)

Loads the keys from the default translation file and builds a tree of keys.

protected override TranslationTree? InternalLoadTranslationStructure(string content, TextFormat? textProcessingMode)

Parameters

content string

The content to parse.

textProcessingMode TextFormat?

The mode of processing of the text of the default file.

Returns

TranslationTree

The constructed TranslationTree upon success or null otherwise.

Exceptions

TextParseException

Gets thrown when parsing of a default translation file fails.

LoadTranslationWithLocations(string, CultureInfo?, TextFormat?)

Parses the translation using a streaming XML reader that captures exact key positions. Called when PopulateKeyLocations is true.

protected override Translation? LoadTranslationWithLocations(string translationText, CultureInfo? culture, TextFormat? textProcessingMode)

Parameters

translationText string
culture CultureInfo
textProcessingMode TextFormat?

Returns

Translation

Use()

Initializes the parser class, making it available for use.

public static void Use()