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 BaseTableParser

    The base class for CSV and TSV parsers.

    Inheritance
    object
    BaseParser
    BaseTableParser
    CsvParser
    TsvParser
    Inherited Members
    BaseParser.RecognizeFileRefs
    BaseParser.StringHasParameters(string, TextFormat)
    BaseParser.GetTextProcessingMode()
    BaseParser.LoadTranslationStructure(string, string, out TranslationConfiguration)
    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 BaseTableParser : BaseParser

    Properties

    DescriptionColumnCaption

    Use this property to override the caption by which the description column was detected.

    Declaration
    public static string DescriptionColumnCaption { get; set; }
    Property Value
    Type Description
    string

    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

    TreatEmptyValuesAsAbsent

    Gets or sets the indicator that tells the parser to treat empty values as missing instead of being empty.

    When the text is missing from the specific translation, the text from the basic locale or from the default locale will be used. When the text is empty, this empty value will be used without a fallback to the basic or default locale.

    Declaration
    public static bool TreatEmptyValuesAsAbsent { get; set; }
    Property Value
    Type Description
    bool

    UseDefaultFileForTranslations

    Declaration
    public override bool UseDefaultFileForTranslations { get; }
    Property Value
    Type Description
    bool
    Overrides
    BaseParser.UseDefaultFileForTranslations

    Methods

    CanHandleExtension(string)

    Checks whether this parser can handle a translation file with the given extension.

    This method is not used for configuration files.

    Declaration
    public override bool CanHandleExtension(string fileExtension)
    Parameters
    Type Name Description
    string fileExtension

    The extension to check.

    Returns
    Type Description
    bool

    true if the extension is supported and false otherwise.

    Overrides
    BaseParser.CanHandleExtension(string)

    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.

    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?)

    ReadCells(string, int, int, List<string>, out int)

    Reads cells from the provided text starting at position offset.

    This is an abstract function overridden by specific parsers which implement the logic or call the ReadCells(string, int, int, List<string>, out int) method with the required parameters for the default implementation.

    Declaration
    protected abstract void ReadCells(string content, int offset, int lineNumber, List<string> buffer, out int posAfterEnd)
    Parameters
    Type Name Description
    string content

    The text, from which the cells are read.

    int offset

    The starting position of the text to read from.

    int lineNumber

    The current line being processed. Used for error reporting.

    List<string> buffer

    The container for read cells.

    int posAfterEnd

    Upon return, is set to the position of the first character beyond the read one. EOL characters are skipped, so the value must reference the start of the next line.

    ReadDelimitedLine(string, int, int, List<string>, out int, char, bool)

    The implementation of reading cells from the provided text starting at position offset.

    Declaration
    protected static void ReadDelimitedLine(string content, int offset, int lineNumber, List<string> buffer, out int posAfterEnd, char separator, bool quotedFields)
    Parameters
    Type Name Description
    string content

    The text, from which the cells are read.

    int offset

    The starting position of the text to read from.

    int lineNumber

    The current line being processed. Used for error reporting.

    List<string> buffer

    The container for read cells.

    int posAfterEnd

    Upon return, is set to the position of the first character beyond the read one. EOL characters are skipped, so the value must reference the start of the next line.

    char separator

    The separator character (comma, tab, maybe something else).

    bool quotedFields

    Specifies whether cells are expected to be enclosed in quotes.

    Exceptions
    Type Condition
    ArgumentNullException

    Thrown if content or buffer is null.

    TextParseException

    Thrown when parsing ends with unclosed quotes (when they are used).

    Events

    OnCultureNameMatchCheck

    Handle this event to match the column caption to a specific locale. For example, if the request is made for "de-AT" locale, you can provide the translation from the column captioned "German".

    Declaration
    public static event EventHandler<CultureNameMatchEventArgs>? OnCultureNameMatchCheck
    Event Type
    Type Description
    EventHandler<CultureNameMatchEventArgs>
    In this article
    Back to top Generated by DocFX