Qt Linguist Manual: TS File Format▲
The TS file format used by Qt Linguist is described by the XSD presented below, which we include for your convenience. Be aware that the format may change in future Qt releases.
Sélectionnez
&
lt;?xml version=
"1.0"
encoding=
"utf-8"
?&
gt;
&
lt;!--
!
!
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
.
!
--&
gt;
&
lt;xs:schema elementFormDefault=
"qualified"
xmlns:xs=
"http://www.w3.org/2001/XMLSchema"
&
gt;
&
lt;!--
value contains decimal (e.g. 1000
) or
hex (e.g. x3e8) unicode encoding of one char
--&
gt;
&
lt;xs:element name=
"byte"
&
gt;
&
lt;xs:complexType&
gt;
&
lt;xs:attribute name=
"value"
type=
"xs:string"
use=
"required"
/&
gt;
&
lt;/
xs:complexType&
gt;
&
lt;/
xs:element&
gt;
&
lt;!--
!
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.
--&
gt;
&
lt;xs:complexType name=
"byte-type"
mixed=
"true"
&
gt;
&
lt;xs:choice minOccurs=
"0"
maxOccurs=
"unbounded"
&
gt;
&
lt;xs:element ref=
"byte"
/&
gt;
&
lt;/
xs:choice&
gt;
&
lt;/
xs:complexType&
gt;
&
lt;!--
!
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
--&
gt;
&
lt;xs:element name=
"extra-something"
type=
"byte-type"
/&
gt;
&
lt;xs:element name=
"TS"
&
gt;
&
lt;xs:complexType&
gt;
&
lt;xs:sequence&
gt;
&
lt;xs:element minOccurs=
"0"
maxOccurs=
"unbounded"
ref=
"extra-something"
/&
gt;
&
lt;xs:element minOccurs=
"0"
maxOccurs=
"1"
ref=
"dependencies"
/&
gt;
&
lt;xs:choice minOccurs=
"1"
maxOccurs=
"unbounded"
&
gt;
&
lt;xs:element ref=
"context"
/&
gt;
&
lt;xs:element ref=
"message"
/&
gt;
&
lt;/
xs:choice&
gt;
&
lt;/
xs:sequence&
gt;
&
lt;xs:attribute name=
"version"
type=
"xs:string"
/&
gt;
&
lt;xs:attribute name=
"sourcelanguage"
type=
"xs:string"
/&
gt;
&
lt;xs:attribute name=
"language"
type=
"xs:string"
/&
gt;
&
lt;/
xs:complexType&
gt;
&
lt;/
xs:element&
gt;
&
lt;xs:element name=
"context"
&
gt;
&
lt;xs:complexType&
gt;
&
lt;xs:sequence&
gt;
&
lt;xs:element ref=
"name"
/&
gt;
&
lt;xs:element minOccurs=
"0"
maxOccurs=
"1"
ref=
"comment"
/&
gt;
&
lt;xs:element minOccurs=
"1"
maxOccurs=
"unbounded"
ref=
"message"
/&
gt;
&
lt;/
xs:sequence&
gt;
&
lt;xs:attribute name=
"encoding"
type=
"xs:string"
/&
gt;
&
lt;/
xs:complexType&
gt;
&
lt;/
xs:element&
gt;
&
lt;xs:element name=
"dependencies"
&
gt;
&
lt;xs:complexType&
gt;
&
lt;xs:sequence&
gt;
&
lt;xs:element minOccurs=
"1"
maxOccurs=
"unbounded"
ref=
"dependency"
/&
gt;
&
lt;/
xs:sequence&
gt;
&
lt;/
xs:complexType&
gt;
&
lt;/
xs:element&
gt;
&
lt;xs:element name=
"dependency"
&
gt;
&
lt;xs:complexType&
gt;
&
lt;xs:attribute name=
"catalog"
type=
"xs:string"
/&
gt;
&
lt;/
xs:complexType&
gt;
&
lt;/
xs:element&
gt;
&
lt;xs:element name=
"name"
type=
"byte-type"
/&
gt;
&
lt;!--
This is "disambiguation"
in the (new
) API, or
"msgctxt"
in gettext speak --&
gt;
&
lt;xs:element name=
"comment"
type=
"byte-type"
/&
gt;
&
lt;!--
Previous content of comment (result of merge) --&
gt;
&
lt;xs:element name=
"oldcomment"
type=
"byte-type"
/&
gt;
&
lt;!--
The real comment (added by developer/
designer) --&
gt;
&
lt;xs:element name=
"extracomment"
type=
"byte-type"
/&
gt;
&
lt;!--
Comment added by translator --&
gt;
&
lt;xs:element name=
"translatorcomment"
type=
"byte-type"
/&
gt;
&
lt;xs:element name=
"message"
&
gt;
&
lt;xs:complexType&
gt;
&
lt;xs:sequence&
gt;
&
lt;xs:element minOccurs=
"0"
maxOccurs=
"unbounded"
ref=
"location"
/&
gt;
&
lt;xs:element minOccurs=
"0"
maxOccurs=
"1"
ref=
"source"
/&
gt;
&
lt;xs:element minOccurs=
"0"
maxOccurs=
"1"
ref=
"oldsource"
/&
gt;
&
lt;xs:element minOccurs=
"0"
maxOccurs=
"1"
ref=
"comment"
/&
gt;
&
lt;xs:element minOccurs=
"0"
maxOccurs=
"1"
ref=
"oldcomment"
/&
gt;
&
lt;xs:element minOccurs=
"0"
maxOccurs=
"1"
ref=
"extracomment"
/&
gt;
&
lt;xs:element minOccurs=
"0"
maxOccurs=
"1"
ref=
"translatorcomment"
/&
gt;
&
lt;xs:element minOccurs=
"0"
maxOccurs=
"1"
ref=
"translation"
/&
gt;
&
lt;xs:element minOccurs=
"0"
maxOccurs=
"1"
ref=
"userdata"
/&
gt;
&
lt;xs:element minOccurs=
"0"
maxOccurs=
"unbounded"
ref=
"extra-something"
/&
gt;
&
lt;/
xs:sequence&
gt;
&
lt;xs:attribute name=
"id"
type=
"xs:string"
/&
gt;
&
lt;xs:attribute default
=
"no"
name=
"numerus"
&
gt;
&
lt;xs:simpleType&
gt;
&
lt;xs:restriction base=
"xs:NMTOKEN"
&
gt;
&
lt;xs:enumeration value=
"yes"
/&
gt;
&
lt;xs:enumeration value=
"no"
/&
gt;
&
lt;/
xs:restriction&
gt;
&
lt;/
xs:simpleType&
gt;
&
lt;/
xs:attribute&
gt;
&
lt;/
xs:complexType&
gt;
&
lt;/
xs:element&
gt;
&
lt;!--
!
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 1
st location in a message,
!
"current"
is the filename used for
the 1
st 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.
--&
gt;
&
lt;xs:element name=
"location"
&
gt;
&
lt;xs:complexType&
gt;
&
lt;xs:attribute name=
"filename"
type=
"xs:string"
/&
gt;
&
lt;xs:attribute name=
"line"
type=
"xs:string"
/&
gt;
&
lt;/
xs:complexType&
gt;
&
lt;/
xs:element&
gt;
&
lt;xs:element name=
"source"
type=
"byte-type"
/&
gt;
&
lt;!--
Previous content of source (result of merge) --&
gt;
&
lt;xs:element name=
"oldsource"
type=
"byte-type"
/&
gt;
&
lt;!--
!
The following should really say one byte-
type or
several
!
numerusform or
lengthvariant elements.
--&
gt;
&
lt;xs:element name=
"translation"
&
gt;
&
lt;xs:complexType mixed=
"true"
&
gt;
&
lt;xs:choice minOccurs=
"0"
maxOccurs=
"unbounded"
&
gt;
&
lt;xs:element ref=
"byte"
/&
gt;
&
lt;xs:element ref=
"numerusform"
/&
gt;
&
lt;xs:element ref=
"lengthvariant"
/&
gt;
&
lt;/
xs:choice&
gt;
&
lt;!--
!
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.
--&
gt;
&
lt;xs:attribute name=
"type"
&
gt;
&
lt;xs:simpleType&
gt;
&
lt;xs:restriction base=
"xs:NMTOKEN"
&
gt;
&
lt;xs:enumeration value=
"unfinished"
/&
gt;
&
lt;xs:enumeration value=
"vanished"
/&
gt;
&
lt;xs:enumeration value=
"obsolete"
/&
gt;
&
lt;/
xs:restriction&
gt;
&
lt;/
xs:simpleType&
gt;
&
lt;/
xs:attribute&
gt;
&
lt;xs:attribute default
=
"no"
name=
"variants"
&
gt;
&
lt;xs:simpleType&
gt;
&
lt;xs:restriction base=
"xs:NMTOKEN"
&
gt;
&
lt;xs:enumeration value=
"yes"
/&
gt;
&
lt;xs:enumeration value=
"no"
/&
gt;
&
lt;/
xs:restriction&
gt;
&
lt;/
xs:simpleType&
gt;
&
lt;/
xs:attribute&
gt;
&
lt;/
xs:complexType&
gt;
&
lt;/
xs:element&
gt;
&
lt;!--
Deprecated. Use extra-
something --&
gt;
&
lt;xs:element name=
"userdata"
type=
"xs:string"
/&
gt;
&
lt;!--
!
The following should really say one byte-
type or
several
!
lengthvariant elements.
!
Length variants must be ordered by falling display length.
--&
gt;
&
lt;xs:element name=
"numerusform"
&
gt;
&
lt;xs:complexType mixed=
"true"
&
gt;
&
lt;xs:choice minOccurs=
"0"
maxOccurs=
"unbounded"
&
gt;
&
lt;xs:element ref=
"byte"
/&
gt;
&
lt;xs:element ref=
"lengthvariant"
/&
gt;
&
lt;/
xs:choice&
gt;
&
lt;xs:attribute default
=
"no"
name=
"variants"
&
gt;
&
lt;xs:simpleType&
gt;
&
lt;xs:restriction base=
"xs:NMTOKEN"
&
gt;
&
lt;xs:enumeration value=
"yes"
/&
gt;
&
lt;xs:enumeration value=
"no"
/&
gt;
&
lt;/
xs:restriction&
gt;
&
lt;/
xs:simpleType&
gt;
&
lt;/
xs:attribute&
gt;
&
lt;/
xs:complexType&
gt;
&
lt;/
xs:element&
gt;
&
lt;xs:element name=
"lengthvariant"
type=
"byte-type"
/&
gt;