summaryrefslogtreecommitdiffstats
path: root/src/linguist/shared/ts.xsd
blob: a7c29b3f5cb9bdb46ed66e8ae726758f5fb4054a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
<?xml version="1.0" encoding="utf-8"?>
<!--
 !
 ! Some notes to the XSD:
 !
 ! The location element is set as optional since it was introduced first in Qt 4.2.
 ! The userdata element is set as optional since it was introduced first in Qt 4.4.
 ! The vanished message type was introduced first in Qt 5.2.
 !
  -->
<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <!-- value contains decimal (e.g. 1000) or hex (e.g. x3e8) unicode encoding of one char -->
  <xs:element name="byte">
      <xs:complexType>
        <xs:attribute name="value" type="xs:string" use="required" />
      </xs:complexType>
    </xs:element>
  <!--
   ! Type used in order to escape byte entities not allowed in an xml document
   ! for instance, only #x9, #xA and #xD are allowed characters below #x20.
    -->
  <xs:complexType name="byte-type" mixed="true">
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element ref="byte" />
      </xs:choice>
  </xs:complexType>
  <!--
   ! extra-something should be described as extra-* but wildcard is not valid in XSD. No better solution found.
   ! extra elements may appear in TS and message elements. Each element may appear
   ! only once within each scope. The contents are preserved verbatim; any
   ! attributes are dropped. Currently recognized extra tags include:
   !   extra-po-msgid_plural, extra-po-old_msgid_plural
   !   extra-po-flags (comma-space separated list)
   !   extra-loc-layout_id
   !   extra-loc-feature
   !   extra-loc-blank
    -->
  <xs:element name="extra-something" type= "byte-type"/>
  <xs:element name="TS">
    <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs="0" maxOccurs="unbounded" ref="extra-something" />
        <xs:element minOccurs="0" maxOccurs="1" ref="dependencies" />
        <xs:choice minOccurs="1" maxOccurs="unbounded">
          <xs:element ref="context" />
          <xs:element ref="message" />
        </xs:choice>
      </xs:sequence>
      <xs:attribute name="version" type="xs:string" />
      <xs:attribute name="sourcelanguage" type="xs:string" />
      <xs:attribute name="language" type="xs:string" />
    </xs:complexType>
  </xs:element>
  <xs:element name="context">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="name" />
        <xs:element minOccurs="0" maxOccurs="1" ref="comment" />
        <xs:element minOccurs="1" maxOccurs="unbounded" ref="message"/>
      </xs:sequence>
      <xs:attribute name="encoding" type="xs:string" />
    </xs:complexType>
  </xs:element>
  <xs:element name="dependencies">
    <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs="1" maxOccurs="unbounded" ref="dependency" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="dependency">
    <xs:complexType>
      <xs:attribute name="catalog" type="xs:string" />
    </xs:complexType>
  </xs:element>
  <xs:element name="name" type= "byte-type"/>
  <!-- This is "disambiguation" in the (new) API, or "msgctxt" in gettext speak -->
  <xs:element name="comment" type= "byte-type"/>
  <!-- Previous content of comment (result of merge) -->
  <xs:element name="oldcomment" type= "byte-type"/>
  <!-- The real comment (added by developer/designer) -->
  <xs:element name="extracomment" type= "byte-type"/>
  <!-- Comment added by translator -->
  <xs:element name="translatorcomment" type= "byte-type"/>
  <xs:element name="message">
    <xs:complexType>
      <xs:sequence>
        <xs:element minOccurs="0" maxOccurs="unbounded" ref="location" />
        <xs:element minOccurs="0" maxOccurs="1" ref="source" />
        <xs:element minOccurs="0" maxOccurs="1" ref="oldsource" />
        <xs:element minOccurs="0" maxOccurs="1" ref="comment" />
        <xs:element minOccurs="0" maxOccurs="1" ref="oldcomment" />
        <xs:element minOccurs="0" maxOccurs="1" ref="extracomment" />
        <xs:element minOccurs="0" maxOccurs="1" ref="translatorcomment" />
        <xs:element minOccurs="0" maxOccurs="1" ref="translation" />
        <xs:element minOccurs="0" maxOccurs="1" ref="userdata" />
        <xs:element minOccurs="0" maxOccurs="unbounded" ref="extra-something" />
      </xs:sequence>
      <xs:attribute name="id" type="xs:string" />
      <xs:attribute default="no" name="numerus">
        <xs:simpleType>
          <xs:restriction base="xs:NMTOKEN">
            <xs:enumeration value="yes" />
            <xs:enumeration value="no" />
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
    </xs:complexType>
  </xs:element>
  <!--
   ! If the line is omitted, the location specifies only a file.
   !
   ! location supports relative specifications as well. Line numbers are
   ! relative (explicitly positive or negative) to the last reference to a
   ! given filename; each file starts with current line 0. If the filename
   ! is omitted, the "current" one is used. For the 1st location in a message,
   ! "current" is the filename used for the 1st location of the previous message.
   ! For subsequent locations, it is the filename used for the previous location.
   ! A single TS file has either all absolute or all relative locations.
    -->
  <xs:element name="location">
    <xs:complexType>
      <xs:attribute name="filename" type="xs:string" />
      <xs:attribute name="line" type="xs:string" />
    </xs:complexType>
  </xs:element>
  <xs:element name="source" type= "byte-type"/>
  <!-- Previous content of source (result of merge) -->
  <xs:element name="oldsource" type= "byte-type"/>
  <!--
   ! The following should really say one byte-type or several
   ! numerusform or lengthvariant elements.
    -->
  <xs:element name="translation">
    <xs:complexType mixed="true">
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element ref="byte" />
        <xs:element ref="numerusform" />
        <xs:element ref="lengthvariant" />
      </xs:choice>
      <!--
       ! If no type is set, the message is "finished".
       ! Length variants must be ordered by falling display length.
       ! variants may not be yes if the message has numerus yes.
        -->
      <xs:attribute name="type">
        <xs:simpleType>
          <xs:restriction base="xs:NMTOKEN">
            <xs:enumeration value="unfinished" />
            <xs:enumeration value="vanished" />
            <xs:enumeration value="obsolete" />
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
      <xs:attribute default="no" name="variants">
        <xs:simpleType>
          <xs:restriction base="xs:NMTOKEN">
            <xs:enumeration value="yes" />
            <xs:enumeration value="no" />
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
    </xs:complexType>
  </xs:element>
  <!-- Deprecated. Use extra-something -->
  <xs:element name="userdata" type="xs:string" />
  <!--
   ! The following should really say one byte-type or several
   ! lengthvariant elements.
   ! Length variants must be ordered by falling display length.
    -->
  <xs:element name="numerusform">
    <xs:complexType mixed="true">
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element ref="byte" />
        <xs:element ref="lengthvariant" />
      </xs:choice>
      <xs:attribute default="no" name="variants">
        <xs:simpleType>
          <xs:restriction base="xs:NMTOKEN">
            <xs:enumeration value="yes" />
            <xs:enumeration value="no" />
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
    </xs:complexType>
  </xs:element>
  <xs:element name="lengthvariant" type= "byte-type"/>
</xs:schema>