This repository contains the JSON Schema definition for the Localize.sh toolchain. This schema defines the data structures for parsing, processing, and stringifying localization resources.
schema.json contains all schema definitions:
Document: Represents a parsed resource file (AST + segments)Segment: A single translatable text unit with support for inline tags and attributesTag: Attributes for tag markers within segmentsParseRequest/ParseResponse: Contracts for the Parse operationStringifyRequest/StringifyResponse: Contracts for the Stringify operation
These definitions are intended to be used with a CLI-based toolchain where processors read JSON messages from stdin and write to stdout.
- Parse:
ParseRequest(stdin) -> Processor ->ParseResponse(stdout) - Stringify:
StringifyRequest(stdin) -> Processor ->StringifyResponse(stdout)
A single unit of text for translation.
Properties:
id(string, required): Unique identifier for the segmenttext(string, required): The content string, which may contain placeholder tags (e.g.,Hello {a1}World{/a1})tags(object, optional): A map of tag definitions corresponding to markers in thetext
Example:
{
"id": "a3f8d9c2e1b7456789abcdef01234567",
"text": "Welcome to {a1}Localize.sh{/a1}!",
"tags": {
"a1": {
"href": "https://localize.sh"
}
}
}A tag is a simple object containing key-value pairs of attributes.
Example:
{
"href": "https://example.com"
}A generic representation of a resource file.
Properties:
segments(array, required): A list of translatable units found in the filelayout(object, required): The Abstract Syntax Tree (AST) or structural representation of the original filemetadata(object, optional): Optional file-level metadata
Example:
{
"segments": [
{
"id": "5d41402abc4b2a76b9719d911017c592",
"text": "Hello World"
}
],
"layout": {
"type": "root",
"children": [
{ "type": "segment", "id": "5d41402abc4b2a76b9719d911017c592" },
{ "type": "text", "value": "!" }
]
},
"metadata": {
"version": "1.0",
"locale": "en-US"
}
}