From 53e6ceab80d7d4420d79806894c7df6b3802d4e9 Mon Sep 17 00:00:00 2001
From: enen92 <92enen@gmail.com>
Date: Fri, 3 Aug 2018 19:24:23 +0100
Subject: [schemas] Restrict language addons locale attribute through regex

---
 addons/kodi.resource/language.xsd | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

(limited to 'addons')

diff --git a/addons/kodi.resource/language.xsd b/addons/kodi.resource/language.xsd
index 6178fe2ad9..d073196a10 100644
--- a/addons/kodi.resource/language.xsd
+++ b/addons/kodi.resource/language.xsd
@@ -48,7 +48,7 @@
       <xs:attribute name="point" type="xs:string" use="required"/>
       <xs:attribute name="id" type="simpleIdentifier"/>
       <xs:attribute name="name" type="xs:string"/>
-      <xs:attribute name="locale" type="xs:string"/>
+      <xs:attribute name="locale" type="langIdentifier"/>
       <xs:attribute name="language" type="xs:string"/>
       <xs:attribute name="region" type="xs:string"/>
     </xs:complexType>
@@ -58,4 +58,9 @@
       <xs:pattern value="kodi\.resource\.language"/>
     </xs:restriction>
   </xs:simpleType>
+  <xs:simpleType name="langIdentifier">
+    <xs:restriction base="xs:string">
+      <xs:pattern value="[a-z]{2,3}(_[A-Z]{2}(@\S+)?)?"/>
+    </xs:restriction>
+  </xs:simpleType>
 </xs:schema>
-- 
cgit v1.2.3