Table of Contents

Class XliffWriter

Namespace
Tlumach.Writers
Assembly
Tlumach.Writers.dll

A writer 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 XliffWriter : BaseXmlWriter
Inheritance
XliffWriter
Inherited Members

Properties

ConfigExtension

Gets the extension of the configuration files of the format, with the leading dot (e.g., ".jsoncfg"), or an empty string if the writer does not write configuration files.

public override string ConfigExtension { get; }

Property Value

string

FormatName

Gets the name of the format (e.g., "JSON" or "RESX"), which is also used in error messages.

public override string FormatName { get; }

Property Value

string

SegmentSeparator

Gets or sets the string that separates individual segments within a single translation value. When writing, a value containing this separator is split into multiple XLIFF <segment> elements. Defaults to a tab character, matching SegmentSeparator.

public string SegmentSeparator { get; set; }

Property Value

string

SourceFile

Gets or sets the source filename to use in the XLIFF file. If not set, defaults to the source translation's OriginalFilename or the configuration's DefaultFile.

public string? SourceFile { get; set; }

Property Value

string

TargetFile

Gets or sets the target filename (used for reference/metadata only).

public string? TargetFile { get; set; }

Property Value

string

TranslationExtension

Gets the extension of the translation files of the format, with the leading dot (e.g., ".json").

public override string TranslationExtension { get; }

Property Value

string

Methods

InternalWriteXmlTranslations(Translation, Stream)

Writes the translation as a file of the format.

protected override void InternalWriteXmlTranslations(Translation translation, Stream stream)

Parameters

translation Translation

The translation to write.

stream Stream

The stream to write the resulting file to.

WriteTranslations(TranslationManager, IReadOnlyCollection<CultureInfo>, Stream)

Writes a bilingual XLIFF file, in which the default translation is the source and the translation of the only culture in cultures is the target.

To write a monolingual file, whose source is the translation of one culture, use WriteTranslation(TranslationManager, CultureInfo, Stream).

public override void WriteTranslations(TranslationManager translationManager, IReadOnlyCollection<CultureInfo> cultures, Stream stream)

Parameters

translationManager TranslationManager

The translation manager from which the translations should be picked.

cultures IReadOnlyCollection<CultureInfo>

The list with exactly one culture, the target one.

stream Stream

The stream to write the resulting file to.

Exceptions

TlumachException

cultures does not contain exactly one culture, or the default translation or the translation of the target culture is not available.