Skip to main content

Rigi Documentation

PO parser

Parser ID: PO.

Format: https://www.gnu.org/software/gettext/manual/html_node/PO-Files.html.

Key features:

  • Auto-encoding. The PO parser supports UTF-8 encoding with and without BOM. The generated target files will have the same encoding as the source file.

  • Ignore duplicate entries. All Objects in a PO Object must have a unique Name. Duplicates are considered to be an error. The parser will skip duplicates without a warning.

  • Plural forms are supported.

Parser settings:

  • String id = {msgid}.{msgctxt} (msgctxtInStringid).

    Default: true. 

    If set, the msgctxt element will be included in the string ID. Otherwise, only the msgid will be the string ID. 

    String IDs are hashed

    The string ID, as written in the PO file, can contain invalid characters for Rigi string IDs.

    Therefore, Rigi will calculate a hashed value from {msgid} and optionally {msgctxt}. Example: the hash of string #USA is 7bcd6d34464b3057cdaedff9bc02b94e.

  • Use Unix newlines (unixNewline).

    Default: false.

    If set, the parser will generate a Unix newline (\n). Otherwise, a Windows newline (\r\n) will be generated.

  • Msgstr is source (sourceMsgstr).

    Default: false.

    The source strings are written in the element msgid.

    When you set this option to true, the Rigi parser will take the string ID from msgid and the source string from msgstr.

  • Maxlen file path (maxlen-filepath).

    Relative or absolute file path to an Excel file containing the information about the maximum string length.

    The Excel file must have the following format:

    • Row 1 is the header with 2 columns:

      • A: String ID.

      • B: String length in characters. To define the length in bytes, put the word ‘bytes’ in the header.

    • Rows 2 and further contain the information.

Generate target

The first element in a PO file contains the definition of whether the msgid is empty (msgid ""). The parser will populate the Language and Plural-Forms when it generates a target.

PO_parser.png

For other parser settings, see the Generic parser settings article.