This repository contains the Protocol Buffers definitions for the Localize.sh toolchain. These schemas define the data structures for parsing, processing, and stringifying localization resources.
localize/document.proto: Defines theDocumentstructure, which represents a parsed resource file (AST + segments).localize/segment.proto: Defines theSegmentunit, representing a single translatable text unit with support for inline tags and attributes.localize/processor.proto: Defines the request and response contracts for CLI processors (ParseandStringifyoperations).
These definitions are intended to be used with a CLI-based toolchain where processors read Protobuf messages from stdin and write to stdout.
- Parse:
ParseRequest(stdin) -> Processor ->ParseResponse(stdout) - Stringify:
StringifyRequest(stdin) -> Processor ->StringifyResponse(stdout)
A generic representation of a resource file.
segments: A list of translatable units found in the file.layout: The Abstract Syntax Tree (AST) or structural representation of the original file (usinggoogle.protobuf.Struct).metadata: Optional file-level metadata.
A single unit of text for translation.
id: Unique identifier for the segment.text: The content string, which may contain placeholder tags (e.g.,Hello {a1}World{/a1}).tags: A map of tag definitions corresponding to markers in thetext.
Attributes for a specific tag marker within a segment.
attrs: Key-value pairs of attributes for the tag (e.g.,href,style).