Table of Contents

Class BaseKeyValueWriter

Namespace
Tlumach.Writers
Assembly
Tlumach.Writers.dll

The base class for the writers of key-value formats (INI, TOML). Each translation file of these formats holds one language; the part of a key before its last dot becomes the name of a section.

public abstract class BaseKeyValueWriter : BaseWriter
Inheritance
BaseKeyValueWriter
Derived
Inherited Members

Methods

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.

WriteConfiguration(TranslationManager, Stream)

Writes the default configuration of the translation manager (DefaultConfiguration) as a configuration file of the format.

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

The translation manager has no default configuration, or the format does not support configuration files.

WriteKeyValueLine(string, string, StringBuilder)

Appends a line with a key and its value to the file being written, quoting and escaping them as the format requires.

protected abstract void WriteKeyValueLine(string key, string value, StringBuilder stringBuilder)

Parameters

key string

The key (within the current section).

value string

The value.

stringBuilder StringBuilder

The builder of the file.

WriteSection(string, StringBuilder)

Appends the header of a section to the file being written.

protected abstract void WriteSection(string key, StringBuilder stringBuilder)

Parameters

key string

The name of the section.

stringBuilder StringBuilder

The builder of the file.

WriteTranslation(TranslationManager, CultureInfo, Stream)

Writes translations in the format that supports one language in one file.

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)

Always throws an exception, as the format does not support multiple languages in one file. Use WriteTranslation(TranslationManager, CultureInfo, Stream) instead.

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

Always.