Add KSY for QM
This commit is contained in:
parent
dae027e21d
commit
1a2e633b0e
|
@ -0,0 +1,200 @@
|
|||
meta:
|
||||
id: qm
|
||||
title: Compiled Qt translations
|
||||
application: Qt
|
||||
file-extension: qm
|
||||
license: GPL-3.0-or-later
|
||||
encoding: utf-8
|
||||
endian: be
|
||||
seq:
|
||||
- id: magic
|
||||
contents: [0x3C, 0xB8, 0x64, 0x18,
|
||||
0xCA, 0xEF, 0x9C, 0x95,
|
||||
0xCD, 0x21, 0x1C, 0xBF,
|
||||
0x60, 0xA1, 0xBD, 0xDD]
|
||||
- id: blocks
|
||||
type: block
|
||||
repeat: eos
|
||||
types:
|
||||
block:
|
||||
-webide-representation: '{tag}'
|
||||
seq:
|
||||
- id: tag
|
||||
type: u1
|
||||
enum: block_tag
|
||||
- id: length
|
||||
type: u4
|
||||
- id: contents
|
||||
type:
|
||||
switch-on: tag
|
||||
cases:
|
||||
'block_tag::contexts': contexts
|
||||
'block_tag::hashes': hashes
|
||||
'block_tag::messages': messages
|
||||
'block_tag::numerus_rules': numerus_rules
|
||||
'block_tag::dependencies': dependencies
|
||||
'block_tag::language': language
|
||||
size: length
|
||||
contexts:
|
||||
seq:
|
||||
- id: length
|
||||
type: u2
|
||||
- id: offsets
|
||||
type: u2
|
||||
repeat: expr
|
||||
repeat-expr: length
|
||||
- id: contexts
|
||||
type: context
|
||||
repeat: eos
|
||||
types:
|
||||
context:
|
||||
-webide-representation: '{context}'
|
||||
seq:
|
||||
- id: length
|
||||
type: u1
|
||||
- id: context
|
||||
type: str
|
||||
size: length
|
||||
- type: u1
|
||||
if: length % 2 == 0
|
||||
hashes:
|
||||
seq:
|
||||
- id: hashes
|
||||
type: hash
|
||||
repeat: eos
|
||||
types:
|
||||
hash:
|
||||
-webide-representation: '{hash}'
|
||||
seq:
|
||||
- id: hash
|
||||
type: u4
|
||||
- id: offset
|
||||
type: u4
|
||||
messages:
|
||||
seq:
|
||||
- id: messages
|
||||
type: message
|
||||
repeat: eos
|
||||
types:
|
||||
message:
|
||||
seq:
|
||||
- id: attributes
|
||||
type: attribute
|
||||
repeat: until
|
||||
repeat-until: '_.tag == attribute_tag::end'
|
||||
attribute:
|
||||
-webide-representation: '{tag}'
|
||||
seq:
|
||||
- id: tag
|
||||
type: u1
|
||||
enum: attribute_tag
|
||||
- id: contents
|
||||
type:
|
||||
switch-on: tag
|
||||
cases:
|
||||
'attribute_tag::end': end
|
||||
'attribute_tag::source_text_utf16': utf16string
|
||||
'attribute_tag::translation': utf16string
|
||||
'attribute_tag::context_utf16': utf16string
|
||||
'attribute_tag::hash': hash
|
||||
'attribute_tag::source_text': string
|
||||
'attribute_tag::context': string
|
||||
'attribute_tag::comment': string
|
||||
'attribute_tag::obsolete_2': obsolete_2
|
||||
types:
|
||||
end: {}
|
||||
utf16string:
|
||||
-webide-representation: '{text}'
|
||||
seq:
|
||||
- id: length
|
||||
type: s4
|
||||
- id: text
|
||||
type: str
|
||||
encoding: utf-16be
|
||||
size: length
|
||||
string:
|
||||
-webide-representation: '{text}'
|
||||
seq:
|
||||
- id: length
|
||||
type: u4
|
||||
- id: text
|
||||
type: str
|
||||
size: length
|
||||
hash:
|
||||
-webide-representation: '{hash}'
|
||||
seq:
|
||||
- id: hash
|
||||
type: u4
|
||||
obsolete_2:
|
||||
-webide-representation: '{unknown_byte}'
|
||||
seq:
|
||||
- id: unknown_byte
|
||||
type: u1
|
||||
numerus_rules:
|
||||
seq:
|
||||
- id: components
|
||||
type: component
|
||||
repeat: eos
|
||||
types:
|
||||
component:
|
||||
-webide-representation: '{operator}'
|
||||
seq:
|
||||
- id: component
|
||||
type: u1
|
||||
- id: param1
|
||||
type: u1
|
||||
if: operator.to_i <= 0x04
|
||||
- id: param2
|
||||
type: u1
|
||||
if: operator == operator::between
|
||||
instances:
|
||||
is_arithmetic:
|
||||
value: component & 0x80 != 0x80
|
||||
not:
|
||||
value: is_arithmetic and component & 0x08 == 0x08
|
||||
mod10:
|
||||
value: is_arithmetic and component & 0x10 == 0x10
|
||||
mod100:
|
||||
value: is_arithmetic and component & 0x20 == 0x20
|
||||
leading1000:
|
||||
value: is_arithmetic and component & 0x40 == 0x40
|
||||
operator:
|
||||
value: is_arithmetic ? component & 0b111 : component
|
||||
enum: operator
|
||||
enums:
|
||||
operator:
|
||||
0x01: equality
|
||||
0x02: less_than
|
||||
0x03: less_or_equal
|
||||
0x04: between
|
||||
0xfd: and
|
||||
0xfe: or
|
||||
0xff: new_rule
|
||||
dependencies:
|
||||
seq:
|
||||
- id: dependencies
|
||||
type: strz
|
||||
repeat: eos
|
||||
language:
|
||||
-webide-representation: '{language}'
|
||||
seq:
|
||||
- id: language
|
||||
type: strz
|
||||
enums:
|
||||
block_tag:
|
||||
0x2F: contexts
|
||||
0x42: hashes
|
||||
0x69: messages
|
||||
0x88: numerus_rules
|
||||
0x96: dependencies
|
||||
0xa7: language
|
||||
attribute_tag:
|
||||
1: end
|
||||
2: source_text_utf16
|
||||
3: translation
|
||||
4: context_utf16
|
||||
5: hash
|
||||
6: source_text
|
||||
7: context
|
||||
8: comment
|
||||
9: obsolete_2
|
|
@ -4,6 +4,8 @@ title: Compiled Qt translations
|
|||
|
||||
The compiled Qt translation file (`*.qm`) is generated by [Qt Linguist][qt-linguist] and holds all the translation data that a Qt application can use for a single language.
|
||||
|
||||
I have written [a Kaitai Struct YAML schema](./qm.ksy) for this format.
|
||||
|
||||
## Conventions used in this document
|
||||
|
||||
* When left unspecified, a number is signed.
|
||||
|
|
Loading…
Reference in New Issue