Class BaseTableWriter
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
sbStringBuilderThe builder of the file.
InternalWriteTranslations(TranslationManager, IReadOnlyCollection<CultureInfo>, Stream)
Writes translations.
protected override void InternalWriteTranslations(TranslationManager translationManager, IReadOnlyCollection<CultureInfo> cultures, Stream stream)
Parameters
translationManagerTranslationManagerThe translation manager from which the translations should be picked.
culturesIReadOnlyCollection<CultureInfo>The list of cultures to write.
streamStreamThe 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
valuestringThe value of the cell.
sbStringBuilderThe 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
translationManagerTranslationManagerThe translation manager whose configuration should be written.
streamStreamThe 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
translationManagerTranslationManagerThe translation manager from which the translations should be picked.
cultureCultureInfoThe culture to write.
Set this parameter to InvariantCulture to signal that the default translation should be written.
streamStreamThe 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
translationManagerTranslationManagerThe translation manager from which the translations should be picked.
culturesIReadOnlyCollection<CultureInfo>The list of cultures to write.
streamStreamThe stream to write the resulting file to.
Exceptions
- TlumachException
culturesis empty, or there is no translation for one of the cultures.