{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "@context": [
    "https://schemas.meta-aiml.org/v3.0.0/context.jsonld"
  ],
  "@id": "https://schemas.meta-aiml.org/v3.0.0/components/multilingual_format.json",
  "@type": [
    "Thing",
    "ComponentSchema"
  ],
  "schemaVersion": "3.0.0",
  "aimlVersion": "3.0.0",
  "title": "Multilingual Format Component",
  "description": "Reusable multilingual text and localization formats",
  "type": "object",
  "$defs": {
    "LocalizedText": {
      "title": "Localized Text",
      "type": "object",
      "description": "Multi-language text object with mandatory English baseline.",
      "required": [
        "en"
      ],
      "properties": {
        "en": {
          "type": "string",
          "minLength": 1
        }
      },
      "additionalProperties": {
        "type": "string",
        "minLength": 1
      },
      "minProperties": 1
    },
    "LocalizedTextOrString": {
      "title": "Localized Text Or String",
      "description": "Compatibility format for optional legacy fields.",
      "oneOf": [
        {
          "$ref": "#/$defs/LocalizedText"
        },
        {
          "type": "string",
          "minLength": 1
        }
      ]
    },
    "LocalizedUrl": {
      "title": "Localized URL",
      "description": "URLs for different language versions",
      "type": "object",
      "additionalProperties": {
        "type": "string",
        "format": "uri"
      }
    },
    "Localization": {
      "title": "Localization Info",
      "description": "Localization configuration",
      "type": "object",
      "properties": {
        "supportedLanguages": {
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^[a-z]{2}(-[A-Z]{2})?$"
          },
          "minItems": 1
        },
        "defaultLanguage": {
          "type": "string",
          "pattern": "^[a-z]{2}(-[A-Z]{2})?$"
        },
        "autoDetect": {
          "type": "boolean"
        },
        "rtlLanguages": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    }
  },
  "validationMetadata": {
    "schemaVersion": "3.0.0",
    "phase": "phase_1",
    "status": "draft",
    "lastValidated": "2026-02-19",
    "validator": "META-AIML QA"
  },
  "semanticAnnotations": {
    "type": "object",
    "description": "Semantic guidance for multilingual field usage in META-AIML v3 schemas.",
    "properties": {
      "minimumLanguageRequirement": {
        "type": "string",
        "const": "All entity schemas MUST include at minimum an 'en' (English) key in name and description fields.",
        "description": "Spec requirement for baseline language support."
      },
      "localizedFieldNames": {
        "type": "array",
        "description": "Fields in entity schemas that support LocalizedText format.",
        "const": [
          "name",
          "description",
          "shortDescription",
          "tagline",
          "keywords"
        ]
      },
      "isoStandards": {
        "type": "object",
        "description": "ISO standards used in this component.",
        "properties": {
          "languageCodes": {
            "type": "string",
            "const": "ISO 639-1 (2-letter, e.g., 'en', 'es', 'fr', 'de', 'zh')"
          },
          "regionCodes": {
            "type": "string",
            "const": "ISO 3166-1 alpha-2 (e.g., 'US', 'GB', 'DE', 'CN')"
          },
          "currencyCodes": {
            "type": "string",
            "const": "ISO 4217 (e.g., 'USD', 'EUR', 'GBP', 'JPY')"
          },
          "dateFormat": {
            "type": "string",
            "const": "ISO 8601 (e.g., '2026-02-19', '2026-02-19T14:30:00Z')"
          }
        }
      }
    }
  },
  "governanceMetadata": {
    "type": "object",
    "description": "Governance and versioning for this component.",
    "properties": {
      "componentVersion": {
        "type": "string",
        "const": "3.0.0"
      },
      "introducedIn": {
        "type": "string",
        "const": "META-AIML v3.0.0"
      },
      "stabilityLevel": {
        "type": "string",
        "const": "stable"
      },
      "usageGuidelines": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "const": [
          "Always include 'en' as the default/fallback language in LocalizedText.",
          "Language codes must be lowercase ISO 639-1 (e.g., 'en', not 'EN' or 'english').",
          "For RTL languages (Arabic, Hebrew), ensure UI layer handles text direction.",
          "Currency formatting should use Intl.NumberFormat or equivalent locale-aware library.",
          "Date display should use locale-appropriate format even if stored as ISO 8601."
        ]
      }
    }
  },
  "examples": {
    "type": "array",
    "description": "Example usages of LocalizedText and Localization in entity schemas.",
    "items": {
      "type": "object"
    },
    "examples": [
      {
        "field": "name",
        "value": {
          "en": "Bella Vista Restaurant",
          "es": "Restaurante Bella Vista",
          "fr": "Restaurant Bella Vista"
        },
        "note": "Minimum requirement: 'en' key. Additional languages optional."
      },
      {
        "field": "description",
        "value": {
          "en": "A cozy restaurant serving fresh Italian-Mediterranean cuisine."
        },
        "note": "Full description in English. Should be 50+ characters per spec."
      },
      {
        "field": "localization",
        "value": {
          "primaryLanguage": "en",
          "supportedLanguages": [
            "en",
            "es",
            "fr"
          ],
          "defaultCurrency": "USD",
          "timezone": "America/Los_Angeles"
        }
      }
    ]
  },
  "$id": "https://schemas.meta-aiml.org/v3.0.0/components/multilingual_format.json"
}
