Table of Contents

Class BaseWriter

Namespace
Tlumach.Writers
Assembly
Tlumach.Writers.dll

The basic writer class for specialized format writers. It defines the basic methods that should be implemented by all writers.

public abstract class BaseWriter
Inheritance
BaseWriter
Derived
Inherited Members

Fields

ErrNoConfigInTranslationManager

protected const string ErrNoConfigInTranslationManager = "The translation manager does not have a configuration to save."

Field Value

string

ErrNoTranslationForCultureS1

protected const string ErrNoTranslationForCultureS1 = "No translation found for culture {0}."

Field Value

string

ErrSingleFileFormatS1

protected const string ErrSingleFileFormatS1 = "The {0} format does not support multiple languages in one file. Use the WriteTranslation() method instead."

Field Value

string

Properties

ConfigExtension

public abstract string ConfigExtension { get; }

Property Value

string

FormatName

public abstract string FormatName { get; }

Property Value

string

TranslationExtension

public abstract string TranslationExtension { get; }

Property Value

string

Methods

GetImmediateChild(string, string)

Gets the immediate child key from a parent and its descendant key.

protected static string? GetImmediateChild(string parentKey, string descendantKey)

Parameters

parentKey string

The parent key.

descendantKey string

The descendant key (child, grandchild, etc.).

Returns

string

The immediate child key name, or null if parentKey is not a parent of descendantKey.

GetSectionAndKeyName(string)

protected static (string, string) GetSectionAndKeyName(string key)

Parameters

key string

Returns

(string escaped, string unescaped)

GetSortedEntries(Translation)

protected static List<TranslationEntry> GetSortedEntries(Translation translation)

Parameters

translation Translation

Returns

List<TranslationEntry>

InternalWriteTranslations(TranslationManager, IReadOnlyCollection<CultureInfo>, Stream)

Writes translations.

protected abstract void InternalWriteTranslations(TranslationManager translationManager, IReadOnlyCollection<CultureInfo> cultures, Stream stream)

Parameters

translationManager TranslationManager

The translation translationManager 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.

IsParentKey(string, string)

Determines if the specified key is a parent of the given potential child key.

protected static bool IsParentKey(string parentKey, string childKey)

Parameters

parentKey string

The potential parent key.

childKey string

The potential child key.

Returns

bool

True if parentKey is a parent of childKey; otherwise, false.

ShouldWriteReference(TranslationEntry)

protected virtual bool ShouldWriteReference(TranslationEntry entry)

Parameters

entry TranslationEntry

Returns

bool

WriteConfiguration(TranslationManager, Stream)

public abstract void WriteConfiguration(TranslationManager translationManager, Stream stream)

Parameters

translationManager TranslationManager
stream Stream

WriteTranslation(TranslationManager, CultureInfo, Stream)

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

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

Parameters

translationManager TranslationManager

The translation translationManager 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 translations in the format that supports multiple languages in one file.

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

Parameters

translationManager TranslationManager

The translation translationManager 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.