Class XliffParser
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
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
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
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
fileExtensionstringThe extension to check.
Returns
InternalLoadTranslationEntriesFromXML(XElement, CultureInfo?, Translation?, string, TextFormat?)
protected override Translation InternalLoadTranslationEntriesFromXML(XElement parentNode, CultureInfo? culture, Translation? translation, string groupName, TextFormat? textProcessingMode)
Parameters
parentNodeXElementcultureCultureInfotranslationTranslationgroupNamestringtextProcessingModeTextFormat?
Returns
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
contentstringThe content to parse.
textProcessingModeTextFormat?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
translationTextstringcultureCultureInfotextProcessingModeTextFormat?
Returns
Use()
Initializes the parser class, making it available for use.
public static void Use()