translations (v5 proposal) - sgpinkus/json-schema GitHub Wiki

THIS WIKI IS OBSOLETE. PLEASE SEE THE NEW JSON-SCHEMA-ORG/JSON-SCHEMA-SPEC REPOSITORY.


Note: This proposal has been migrated to https://github.com/json-schema-org/json-schema-spec/issues/53


please note : this is an alternate proposal to the problem described already in multilingual-meta-data-(v5-proposal)

Proposed keywords

  • translations

Purpose

Currently, we are not able to handle i18n for meta keywords consistent. This is an abstract from this discussion where the described syntax was proposed by Francis Galiegue.

Motivating example

For instance, say you want title and description to be based on the users locale:

{
    "title": "postalCode",
    "description": "A postalCode."
}

You can only specify one language per title ...

Values

The value of translations would be an object. The values would be a JSON schema meta keyword and would themselves be objects, where each property key MUST be in accordance with RFC 3066

Example

When translating title and description, you can easily write an object where the meta keywords are RFC3066 conformal:

{
	"title": "postal code",
    "description": "A postal code.",
	"translations": { 
	    "title": { 
	        "en-GB": "postcode",
			"en-US": "zip code",
		    "de": "Postleitzahl",
		    "fr": "code postal"
		},
		"description": {
			"en-GB": "A Royal Mail postcode.",
			"en-US": "An USPS ZIP code.",
		    //  ...
		}
	}
    //  ...
}

Concerns

Where to apply

"What would be left to specify is of course what "relevant" is here. Apart from "title", there is "description". But I don't think we want any other keyword to be affected."