Skip to content

✨ Proposal: Reference W3C string-meta for language and direction metadata on strings #1710

@xfq

Description

@xfq

Describe the inspiration for your proposal

JSON Schema provides annotation keywords (title, description, etc.), but offers no guidance on how to:

  1. Determine or declare the language of a natural-language string value in a JSON instance.
  2. Determine or declare the text direction (LTR, RTL, or auto) of a natural-language string value.
  3. Establish resource-wide defaults for language or direction that apply to multiple string fields.

Schema authors who need to represent natural language content must invent their own conventions with no standard reference to follow, leading to inconsistent interoperability.

Describe the proposal

This proposal suggests adding the W3C Note Strings on the Web: Language and Direction Metadata ("string-meta") as an informative reference to the JSON Schema spec. string-meta provides best practices for identifying the language and text direction of natural-language strings.

string-meta defines a concrete, widely-applicable serialization pattern for natural language text fields:

"field-name": {
    "value": "The actual string",
    "lang": "en-US",
    "dir": "ltr"
}

This pattern uses existing JSON object structure. No new keywords or validation semantics are required. And it works alongside JSON Schema's existing annotation mechanism.

string-meta is a published W3C Group Note from W3C (and is transitioning to a normative document), with editors who have deep expertise in this domain.

The reference could be placed in the annotation keywords section (title, description) noting that for schemas with title or description values, string-meta provides guidance on language/direction metadata.

(If the JSON Schema develops an i18n-focused vocabulary in the future, string-meta could become a normative reference at that point.)

Describe alternatives you've considered

No response

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    proposalInitial discussion of a new idea. A project will be created once a proposal document is created.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions