Table of Contents

Class BaseTableWriter

Namespace
Tlumach.Writers
Assembly
Tlumach.Writers.dll

The base class for the writers of table formats (CSV, TSV). A file of these formats has a row for each key and a column for each language, followed by the description and comments columns.

Table formats have no configuration files.

public abstract class BaseTableWriter : BaseWriter
Inheritance
BaseTableWriter
Derived
Inherited Members

Methods

EndRow(StringBuilder)

Ends the current row.

protected abstract void EndRow(StringBuilder sb)

Parameters

sb StringBuilder

The builder of the file.

InternalWriteTranslations(TranslationManager, IReadOnlyCollection<CultureInfo>, Stream)

Writes translations.

protected override void InternalWriteTranslations(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 of cultures to write.

stream Stream

The stream to write the resulting file to.

WriteCell(string, StringBuilder)

Appends a cell with the given value to the current row, quoting and escaping the value as the format requires.

protected abstract void WriteCell(string value, StringBuilder sb)

Parameters

value string

The value of the cell.

sb StringBuilder

The builder of the file.

WriteConfiguration(TranslationManager, Stream)

Always throws an exception, as table formats have no configuration files. Use a writer of another format (e.g., INI or TOML) to write the configuration.

public override void WriteConfiguration(TranslationManager translationManager, Stream stream)

Parameters

translationManager TranslationManager

The translation manager whose configuration should be written.

stream Stream

The stream to write the resulting file to.

Exceptions

TlumachException

Always.

WriteTranslation(TranslationManager, CultureInfo, Stream)

Writes a table with one language column.

public override void WriteTranslation(TranslationManager translationManager, CultureInfo culture, Stream stream)

Parameters

translationManager TranslationManager

The translation manager from which the translations should be picked.

culture CultureInfo

The culture to write.

Set this parameter to InvariantCulture to signal that the default translation should be written.

stream Stream

The stream to write the resulting file to.

WriteTranslations(TranslationManager, IReadOnlyCollection<CultureInfo>, Stream)

Writes a table with a column for each of the cultures. The column of the default translation, if it is among the cultures, comes first; the keys of the first column define the rows.

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 of cultures to write.

stream Stream

The stream to write the resulting file to.

Exceptions

TlumachException

cultures is empty, or there is no translation for one of the cultures.