Lang cds

From The Ghar Station Wiki
Jump to: navigation, search

The language files in RIFT are used for localization.

They consist of a key which is used in other parts of RIFT and text for that key.

Files

There are language files for some of the supported languages, they can be found in the RIFT asset files. By default, only the language file associated with the chosen language in Glyph is downloaded and added to the assets.

Name
lang_english.cds
lang_french.cds
lang_russian.cds
lang_german.cds

A reference C# implementation to read this data can be found here: https://github.com/imathrowback/telarafly/blob/master/Assets/RiftAssets/EnglishLang.cs

Format

The language files have the following format:

Header

Bytes/Offset Content Comment
4 bytes 32bit integer Number of language text entries
1024 bytes byte Huffman Frequency values

Entries Offsets

Following the header is an array of entries up to the amount read in the header. Each entry is variable in length.

Bytes/Offset Content Comment
4 bytes 32bit integer Entry Key
variable LEB128 LEB128 encoded integer that represents the offset of the entry in the file

Entries

Following the entries offset table are the actual entries up to the amount read in the header, they are in the same order as the keys above.

Bytes/Offset Content Comment
variable LEB128 Encoded integer that represents the compressed size of the data stream
variable LEB128 Encoded integer that represents the uncompressed size of the data stream
variable compressed binary serialized data Data represents a language class entry, this data is compressed and is encoded in the binary serialization format as most other RIFT data: DAT_Format

To decompress the data you must use the frequency table read earlier to create a Huffman Reader: https://github.com/imathrowback/telarafly/blob/master/Assets/DatParser/HuffmanReader.cs