Table of Contents

Class BaseJsonParser

Namespace
Tlumach.Base
Assembly
Tlumach.Base.dll

The base parser for JSON-formatted configuration and translation files.

public abstract class BaseJsonParser : BaseParser
Inheritance
BaseJsonParser
Derived
Inherited Members

Properties

LocaleSeparatorChar

Gets or sets the character that is used to separate the locale name from the base name in the names of locale-specific translation files.

public static char LocaleSeparatorChar { get; set; }

Property Value

char

Methods

GetLocaleSeparatorChar()

Used for internal needs.

public override char GetLocaleSeparatorChar()

Returns

char

The character, used to separate the base file name and the locale.

InternalLoadTranslationEntriesFromJSON(JsonElement, Translation?, string, TextFormat?)

protected abstract Translation InternalLoadTranslationEntriesFromJSON(JsonElement jsonObj, Translation? translation, string groupName, TextFormat? textProcessingMode)

Parameters

jsonObj JsonElement
translation Translation
groupName string
textProcessingMode TextFormat?

Returns

Translation

InternalLoadTranslationStructure(string, TextFormat?)

Loads the keys from the default translation file and builds a tree of keys.

protected override TranslationTree? InternalLoadTranslationStructure(string content, TextFormat? textProcessingMode)

Parameters

content string

The content to parse.

textProcessingMode TextFormat?

The mode of processing of the text of the default file.

Returns

TranslationTree

The constructed TranslationTree upon success or null otherwise.

Exceptions

TextParseException

Gets thrown when parsing of a default translation file fails.

LoadTranslation(string, CultureInfo?, TextFormat?)

Loads the translation information from the file and returns a translation.

public override Translation? LoadTranslation(string translationText, CultureInfo? culture, TextFormat? textProcessingMode)

Parameters

translationText string

The text of the file to load.

culture CultureInfo

An optional reference to the locale, whose translation is to be loaded. Makes sense for CSV and TSV formats that may contain multiple translations in one file.

textProcessingMode TextFormat?

The mode of processing of the text of the translation file.

Returns

Translation

The loaded translation or null if loading failed.

ParseConfiguration(string, Assembly?)

public override TranslationConfiguration? ParseConfiguration(string fileContent, Assembly? assembly)

Parameters

fileContent string
assembly Assembly

Returns

TranslationConfiguration

ShouldSkipObjectProperty(string)

protected virtual bool? ShouldSkipObjectProperty(string key)

Parameters

key string

Returns

bool?

ShouldSkipStringProperty(string)

protected virtual bool? ShouldSkipStringProperty(string key)

Parameters

key string

Returns

bool?