Class XliffWriter
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
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
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
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
TargetFile
Gets or sets the target filename (used for reference/metadata only).
public string? TargetFile { get; set; }
Property Value
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
Methods
InternalWriteXmlTranslations(Translation, Stream)
Writes the translation as a file of the format.
protected override void InternalWriteXmlTranslations(Translation translation, Stream stream)
Parameters
translationTranslationThe translation to write.
streamStreamThe 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
translationManagerTranslationManagerThe translation manager from which the translations should be picked.
culturesIReadOnlyCollection<CultureInfo>The list with exactly one culture, the target one.
streamStreamThe stream to write the resulting file to.
Exceptions
- TlumachException
culturesdoes not contain exactly one culture, or the default translation or the translation of the target culture is not available.