From 57d928bb82130f8f1dcbc85ddd5430721a0dbf04 Mon Sep 17 00:00:00 2001
From: StefanVukovic99 <stefanvukovic44@gmail.com>
Date: Thu, 9 May 2024 03:10:48 +0200
Subject: add source and target language dictionary metadata (#891)

* add source and target language dictionary metadata

* validate iso

* add description and grc
---
 ext/data/schemas/dictionary-index-schema.json | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

(limited to 'ext/data')

diff --git a/ext/data/schemas/dictionary-index-schema.json b/ext/data/schemas/dictionary-index-schema.json
index 56726668..27d525c7 100644
--- a/ext/data/schemas/dictionary-index-schema.json
+++ b/ext/data/schemas/dictionary-index-schema.json
@@ -1,6 +1,13 @@
 {
     "$id": "dictionaryIndex",
     "$schema": "http://json-schema.org/draft-07/schema#",
+    "definitions": {
+        "isoLanguageCode": {
+            "type": "string",
+            "description": "ISO language code (ISO 639-1 where possible, ISO 639-3 otherwise).",
+            "pattern": "^(aa|ab|ae|af|ak|am|an|ar|as|av|ay|az|az|ba|be|bg|bh|bi|bm|bn|bo|br|bs|ca|ce|ch|co|cr|cs|cu|cv|cy|da|de|dv|dz|ee|el|en|eo|es|et|eu|fa|ff|fi|fj|fo|fr|fy|ga|gd|gl|gn|grc|gu|gv|ha|he|hi|ho|hr|ht|hu|hy|hz|ia|id|ie|ig|ii|ik|io|is|it|iu|ja|jv|ka|kg|ki|kj|kk|kl|km|kn|ko|kr|ks|ku|kv|kw|ky|la|lb|lg|li|ln|lo|lt|lu|lv|mg|mh|mi|mk|ml|mn|mr|ms|mt|my|na|nb|nd|ne|ng|nl|nn|no|nr|nv|ny|oc|oj|om|or|os|pa|pi|pl|ps|pt|qu|rm|rn|ro|ru|rw|sa|sc|sd|se|sg|si|sk|sl|sm|sn|so|sq|sr|ss|st|su|sv|sw|ta|te|tg|th|ti|tk|tl|tn|to|tr|ts|tt|tw|ty|ug|uk|ur|uz|ve|vi|vo|wa|wo|xh|yi|yo|za|zh|zu)$"
+        }
+    },
     "type": "object",
     "description": "Index file containing information about the data contained in the dictionary.",
     "required": [
@@ -47,6 +54,14 @@
             "type": "string",
             "description": "Attribution information for the dictionary data."
         },
+        "sourceLanguage": {
+            "$ref": "#/definitions/isoLanguageCode",
+            "description": "Language of the terms in the dictionary."
+        },
+        "targetLanguage": {
+            "$ref": "#/definitions/isoLanguageCode",
+            "description": "Main language of the definitions in the dictionary."
+        },
         "frequencyMode": {
             "type": "string",
             "enum": ["occurrence-based", "rank-based"]
-- 
cgit v1.2.3