Skip to content

Main content

Gettext Context Message Separator Token Tool

Compute gettext context message separator token from explicit bounded inputs.

Loading tool…

Description

Find a U+0004 separator and require it to occur at most once.

Parsing depends on the chosen grammar, character encoding, offset unit, and treatment of escapes and delimiters. UTF-16 code-unit positions, Unicode code points, and UTF-8 byte offsets are not interchangeable. A boundary or token check supplies one part of a parser rather than validating an entire file.

Find a U+0004 separator and require it to occur at most once.

When to use this tool

Use Gettext Context Message Separator Token when you need the stated token boundary, offset, prefix, delimiter, or count component inside a larger parsing workflow.

How to use the tool and how it works

  1. Enter token. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. Read context, message, hasContext. Inspect hasContext before interpreting the associated values.

Find a U+0004 separator and require it to occur at most once. Return context before it and message after it, with hasContext=true; when absent return empty context and the original message.1

Input fieldMeaning and unitsAccepted input
tokenComplete literal token in the grammar stated above.Required. Text; maximum UTF-16 length 8192.
Output fieldInterpretationReturned shape
contextContextRequired. Text; maximum UTF-16 length 8192.
messageMessageRequired. Text; maximum UTF-16 length 8192.
hasContextTrue when one U+0004 separator exists, even for an empty context.Required. Boolean.
json
{
  "input": {
    "token": "menu\u0004Open"
  },
  "output": {
    "context": "menu",
    "message": "Open",
    "hasContext": true
  }
}

Limitations and assumptions

  • An explicit empty context and an absent context share an empty string but have different flags. This splits one lookup-key convention without parsing PO/MO files, plural forms, or translation catalogs.
  • Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.

Alternative or Complementary methods

Choose a parser for the intended complete grammar when context, nesting, encodings, or semantic validation matters. Keep byte, code-unit, and code-point coordinates explicit when combining results.

References

  1. Calculation and input contract: parse/gettext-context-message-separator-token — tool.io

Similar or alternative tools

  • Delimiter Overlap Prefix Length

    Find the longest suffix of one literal delimiter that is a prefix of the next, measured in UTF-16 units.

  • Escaped Delimiter Parity

    Inspect an explicitly selected UTF-16 delimiter position under a repeated single-character escape parity convention.