Supporting GUI Translation/Translations DAT Format
The translations.dat file is generated from the po/*.po files in the ScummVM source code repository. It contains the data needed by ScummVM to display a translated GUI.
The file is a binary file with
- a header
- a block with the list of languages
- a block with the the english messages
- a block with the translated messages for language 1
- a block with the translated messages for language 2
- ...
- a block with the translated messages for language n
The following description is valid for version 2 of the file format. Version 1 is very similar but does not contain the context strings in the translated messages.
The header
Type | Size | Order | Description |
---|---|---|---|
String | 12 | 'TRANSLATIONS' | |
Byte | 1 | Version (of the file format) | |
uint16 | 2 | BE | Number of translations |
uint16 | 2 | BE | Size in bytes of block 1 (list of languages) |
uint16 | 2 | BE | Size in bytes of block 2 (english messages) |
uint16 | 2 | BE | Size in bytes of block 3 (first translation) |
uint16 | 2 | BE | Size in bytes of block 4 (second translation) |
... | ... | ... | ... |
uint16 | 2 | BE | Size in bytes of block n+2 (nth translation) |
List of Languages
For each translation there is the following entry:
Type | Size | Order | Description |
---|---|---|---|
uint16 | 2 | BE | Size (in bytes) of the following string (including the terminating '\0') |
String | ?? | Language and country code (e.g. 'de_DE') | |
uint16 | 2 | BE | Size (in bytes) of the language name string (including the terminating '\0') |
String | ?? | Language name (e.g. 'Deutsch') |
English messages
Type | Size | Order | Description |
---|---|---|---|
uint16 | 2 | BE | Number of messages |
First message entry (see below) | |||
Second message entry | |||
... | ... | ... | ... |
Last message entry |
Each message entry has the following format:
Type | Size | Order | Description |
---|---|---|---|
uint16 | 2 | BE | Size (in bytes) of the english message string (including the terminating '\0') |
String | ?? | English message |
The messages are sorted in alphabetical order.
Translated messages
For each translation there is a block with the following format:
Type | Size | Order | Description |
---|---|---|---|
uint16 | 2 | BE | Number of translated messages |
uint16 | 2 | BE | Size (in bytes) of the charset string (including the terminating '\0') |
String | ?? | Charset (e.g. 'iso-8859-1') | |
First translation entry (see below) | |||
... | ... | ... | ... |
Last translation entry |
Each translation entry has the following format:
Type | Size | Order | Description |
---|---|---|---|
uint16 | 2 | BE | Index of the entry in the english message table (index starts at 0) |
uint16 | 2 | BE | Size (in bytes) of the translated message string (including the terminating '\0') |
String | ?? | Translated message | |
uint16 | 2 | BE | Size (in bytes) of the context string (including the terminating '\0'). Size is 0 when there is no context. |
String | ?? | Context string (if a context is defined). |