Class BaseWriter
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
ErrNoTranslationForCultureS1
protected const string ErrNoTranslationForCultureS1 = "No translation found for culture {0}."
Field Value
ErrSingleFileFormatS1
protected const string ErrSingleFileFormatS1 = "The {0} format does not support multiple languages in one file. Use the WriteTranslation() method instead."
Field Value
Properties
ConfigExtension
public abstract string ConfigExtension { get; }
Property Value
FormatName
public abstract string FormatName { get; }
Property Value
TranslationExtension
public abstract string TranslationExtension { get; }
Property Value
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
Returns
GetSectionAndKeyName(string)
protected static (string, string) GetSectionAndKeyName(string key)
Parameters
keystring
Returns
GetSortedEntries(Translation)
protected static List<TranslationEntry> GetSortedEntries(Translation translation)
Parameters
translationTranslation
Returns
InternalWriteTranslations(TranslationManager, IReadOnlyCollection<CultureInfo>, Stream)
Writes translations.
protected abstract void InternalWriteTranslations(TranslationManager translationManager, IReadOnlyCollection<CultureInfo> cultures, Stream stream)
Parameters
translationManagerTranslationManagerThe translation translationManager from which the translations should be picked.
culturesIReadOnlyCollection<CultureInfo>The list of cultures to write.
streamStreamThe 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
Returns
- bool
True if parentKey is a parent of childKey; otherwise, false.
ShouldWriteReference(TranslationEntry)
protected virtual bool ShouldWriteReference(TranslationEntry entry)
Parameters
entryTranslationEntry
Returns
WriteConfiguration(TranslationManager, Stream)
public abstract void WriteConfiguration(TranslationManager translationManager, Stream stream)
Parameters
translationManagerTranslationManagerstreamStream
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
translationManagerTranslationManagerThe translation translationManager 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 translations in the format that supports multiple languages in one file.
public abstract void WriteTranslations(TranslationManager translationManager, IReadOnlyCollection<CultureInfo> cultures, Stream stream)
Parameters
translationManagerTranslationManagerThe translation translationManager from which the translations should be picked.
culturesIReadOnlyCollection<CultureInfo>The list of cultures to write.
streamStreamThe stream to write the resulting file to.