-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #462 from Shopify/feature/translation-file-schema
Add translations schema
- Loading branch information
Showing
2 changed files
with
58 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
{ | ||
"$schema": "https://json-schema.org/draft/2020-12/schema", | ||
"description": "A schema for Shopify theme translation files. Supports nested properties, pluralized translations, and translations containing HTML.", | ||
"type": "object", | ||
"additionalProperties": { | ||
"anyOf": [ | ||
{ | ||
"$ref": "#/$defs/pluralizedString" | ||
}, | ||
{ | ||
"type": "string" | ||
}, | ||
{ | ||
"$ref": "#" | ||
} | ||
] | ||
}, | ||
"patternProperties": { | ||
".*_html$": { | ||
"type": "string", | ||
"description": "Translation string that contains HTML. The '_html' suffix prevents the HTML content from being escaped." | ||
} | ||
}, | ||
"$defs": { | ||
"pluralizedString": { | ||
"type": "object", | ||
"properties": { | ||
"one": { | ||
"type": "string", | ||
"description": "Translation for the singular form" | ||
}, | ||
"other": { | ||
"type": "string", | ||
"description": "Translation for the plural form" | ||
}, | ||
"few": { | ||
"type": "string", | ||
"description": "Translation for 'few' form, used in some languages" | ||
}, | ||
"many": { | ||
"type": "string", | ||
"description": "Translation for 'many' form, used in some languages" | ||
}, | ||
"two": { | ||
"type": "string", | ||
"description": "Translation for 'two' form, used in some languages" | ||
}, | ||
"zero": { | ||
"type": "string", | ||
"description": "Translation for 'zero' form, used in some languages" | ||
} | ||
}, | ||
"additionalProperties": false, | ||
"description": "An object representing a pluralized translation string" | ||
} | ||
} | ||
} |