Tlumach
  • Articles
  • API Reference
Search Results for

    Show / Hide Table of Contents
    • Tlumach
      • Base
        • ArbParser
        • ArbPlaceholder
        • BaseGenerator
        • BaseJsonParser
        • BaseKeyValueParser
        • BaseParser
        • BaseTableParser
        • BaseXMLParser
        • CsvParser
        • CultureNameMatchEventArgs
        • FileFormats
        • GenericParserException
        • IniParser
        • JsonParser
        • ParserConfigException
        • ParserFileException
        • ParserLoadException
        • Placeholder
        • ResxParser
        • TemplateParserException
        • TemplateProcessingException
        • TextFileParseException
        • TextFormat
        • TextParseException
        • TlumachException
        • TomlParser
        • Translation
        • TranslationConfiguration
        • TranslationEntry
        • TranslationTree
        • TranslationTreeLeaf
        • TranslationTreeNode
        • TsvParser
        • Utils
      • BaseTranslationUnit
      • CultureChangedEventArgs
      • FileContentNeededEventArgs
      • TemplatedTranslationUnit
      • TranslationManager
      • TranslationUnit
      • TranslationValueEventArgs

    Class BaseKeyValueParser

    The base parser for key-value configuration and translation files (ini and toml).

    Inheritance
    object
    BaseParser
    BaseKeyValueParser
    IniParser
    TomlParser
    Inherited Members
    BaseParser.RecognizeFileRefs
    BaseParser.UseDefaultFileForTranslations
    BaseParser.StringHasParameters(string, TextFormat)
    BaseParser.GetTextProcessingMode()
    BaseParser.LoadTranslationStructure(string, string, out TranslationConfiguration)
    BaseParser.CanHandleExtension(string)
    BaseParser.ParseConfigurationFile(string)
    BaseParser.ParseConfigurationFile(Assembly, string)
    BaseParser.ValidateConfiguration(TranslationConfiguration)
    BaseParser.GetAbsolutePosition(string, int, int)
    BaseParser.DecodeTextProcessingMode(string)
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Tlumach.Base
    Assembly: Tlumach.Base.dll
    Syntax
    public abstract class BaseKeyValueParser : BaseParser

    Properties

    LineCommentChar

    Declaration
    protected virtual char LineCommentChar { get; }
    Property Value
    Type Description
    char

    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.

    Declaration
    public static char LocaleSeparatorChar { get; set; }
    Property Value
    Type Description
    char

    Methods

    AcceptUnquotedEmptyValues()

    Declaration
    protected abstract bool AcceptUnquotedEmptyValues()
    Returns
    Type Description
    bool

    GetLocaleSeparatorChar()

    Declaration
    public override char GetLocaleSeparatorChar()
    Returns
    Type Description
    char
    Overrides
    BaseParser.GetLocaleSeparatorChar()

    InternalLoadTranslationStructure(string)

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

    Declaration
    protected override TranslationTree? InternalLoadTranslationStructure(string content)
    Parameters
    Type Name Description
    string content

    The content to parse.

    Returns
    Type Description
    TranslationTree

    The constructed TranslationTree upon success or null otherwise.

    Overrides
    BaseParser.InternalLoadTranslationStructure(string)
    Exceptions
    Type Condition
    TextParseException

    Gets thrown when parsing of a default translation file fails.

    IsEndOfKey(string, int, out int)

    Declaration
    protected abstract bool? IsEndOfKey(string content, int offset, out int newPosition)
    Parameters
    Type Name Description
    string content
    int offset
    int newPosition
    Returns
    Type Description
    bool?

    IsEndOfValue(string, int, out int)

    Detects if the end of a value has been reached.

    Declaration
    protected abstract bool? IsEndOfValue(string content, int offset, out int newPosition)
    Parameters
    Type Name Description
    string content

    content to check.

    int offset

    current position within the content.

    int newPosition

    upon return is set to a position next to the end-of-value marker (indicates to which value the pointer must be set).

    Returns
    Type Description
    bool?

    true if the end of the value has been reached, false if the end has not been reached, and null if the end of line was encountered and a single-line value was not closed.

    Exceptions
    Type Condition
    TextParseException

    thrown when an error occurs.

    IsEscapedEOLInValue(string, int)

    Declaration
    protected virtual bool IsEscapedEOLInValue(string content, int offset)
    Parameters
    Type Name Description
    string content
    int offset
    Returns
    Type Description
    bool

    IsSeparatorChar(char)

    Declaration
    protected abstract bool IsSeparatorChar(char candidate)
    Parameters
    Type Name Description
    char candidate
    Returns
    Type Description
    bool

    IsStartOfKey(string, int)

    Declaration
    protected abstract bool IsStartOfKey(string content, int offset)
    Parameters
    Type Name Description
    string content
    int offset
    Returns
    Type Description
    bool

    IsStartOfValue(string, int, out int)

    Declaration
    protected abstract bool IsStartOfValue(string content, int offset, out int posAfterStart)
    Parameters
    Type Name Description
    string content
    int offset
    int posAfterStart
    Returns
    Type Description
    bool

    IsValidKeyChar(string, int)

    Declaration
    protected virtual bool IsValidKeyChar(string content, int offset)
    Parameters
    Type Name Description
    string content
    int offset
    Returns
    Type Description
    bool

    IsValidSectionNameChar(string, int)

    Declaration
    protected virtual bool IsValidSectionNameChar(string content, int offset)
    Parameters
    Type Name Description
    string content
    int offset
    Returns
    Type Description
    bool

    LoadTranslation(string, CultureInfo?)

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

    Declaration
    public override Translation? LoadTranslation(string translationText, CultureInfo? culture)
    Parameters
    Type Name Description
    string translationText

    The text of the file to load.

    CultureInfo culture

    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.

    Returns
    Type Description
    Translation

    The loaded translation or null if loading failed.

    Overrides
    BaseParser.LoadTranslation(string, CultureInfo?)

    ParseConfiguration(string, Assembly?)

    Declaration
    public override TranslationConfiguration? ParseConfiguration(string fileContent, Assembly? assembly)
    Parameters
    Type Name Description
    string fileContent
    Assembly assembly
    Returns
    Type Description
    TranslationConfiguration
    Overrides
    BaseParser.ParseConfiguration(string, Assembly?)

    UnwrapKey(string)

    Strips format-specific markers that denote the beginning and the end of a value.

    Declaration
    protected abstract string UnwrapKey(string value)
    Parameters
    Type Name Description
    string value

    The value to strip.

    Returns
    Type Description
    string

    The text inside the markers.

    UnwrapValue(string)

    Strips format-specific markers that denote the beginning and the end of a value.

    Declaration
    protected abstract (string? escaped, string unescaped) UnwrapValue(string value)
    Parameters
    Type Name Description
    string value

    The value to strip.

    Returns
    Type Description
    (string escaped, string unescaped)

    The text inside the markers.

    In this article
    Back to top Generated by DocFX