Skip to main content

Rigi Documentation

Simple text Parser

Parser ID: txt-simple.

Description:

The text parser parses a file, where each localizable text is on a separate line. Each line consists of a key, a separator, and text, for example:

# Skip this comment
key1 Hello world
key2 This is a line with localizable text.\nThis is the second line.

This example results in 2 key/value pairs:

  • key1 “Hello world”.

  • key2 “ This is a line with localizable text.\nThis is the second line.”.

Parser settings:

  • Key/sep/text (kst-regex).

    A regular expression specifies the pattern to identify the key, separator, and text in a line.

    When a line matches the regular expression, the parser extracts the key, separator, and localizable text. If there is no match, then the line will be skipped (and written as-is to the target file).

    The regular expression must contain the following capture groups: key, sep, and text.

    The default regular expression is:

    ^(?!#)(?<key>\S+)(?<sep>\s)(?<text>.*)$

    This regex will read all lines that contain a key, a space as a separator, and text. Lines that start with # are treated as comments and skipped.