tlk2xml man page
tlk2xml — BioWare TLK to XML converter
|tlk2xml||[options] input_file [output_file]|
tlk2xml converts BioWare's TLK files into human-readable XML. TLK are “talk tables”, a list of strings indexed by an ID, used for all user-visible text in a BioWare game. All strings for a campaign or module are usually collected in one file for each supported language, and languages with sentences that vary wildly depending on whether the player character is male or female use a second TLK with strings for the female version.
There's two distinct TLK formats. One is a whole separate file format (which uses version IDs V3.0 and V4.0), the other is a GFF (and uses version IDs V0.2 and V0.5). Within those two major versions, the differences are smaller: V4.0 removed fields for each string not needed anymore, and V0.5 compresses strings using a Huffman tree. This tool can read all of these variants and produces a human-read XML file.
Because these files contain localized string data, it is important to know the encoding of those strings. Unfortunately, the TLK files do not contain information about the encoding. Version 3.0 and 4.0 contain a language identifier, but the meaning of that varies between games. V0.2 and V0.5 even lack those completely. However, due to the Huffman-nature of V0.5 strings, the encoding there is fixed to little-endian UTF-16, and strings in V0.2 files are also usually in little-endian UTF-16 (with the exceptions of files found in the Nintendo DS game Sonic Chronicles: The Dark Brotherhood). To manually select the encoding, this tool provides a wide range command line options for various encodings.
Alternatively, the game this TLK is from can be specified and tlk2xml will read the strings in an appropriate encoding for that game and the language ID found in the TLK. Please note that this does not work for the game Sonic Chronicles: The Dark Brotherhood, since its TLK files do not provide a language ID.
Show a help text and exit.
Show version information and exit.
Read strings as Windows CP-1250. Eastern European, Latin alphabet.
Read strings as Windows CP-1251. Eastern European, Cyrillic alphabet.
Read strings as Windows CP-1252. Western European, Latin alphabet.
Read strings as Windows CP-932. Japanese, extended Shift-JIS.
Read strings as Windows CP-936. Simplified Chinese, extended GB2312 with GBK codepoints.
Read strings as Windows CP-949. Korean, similar to EUC-KR.
Read strings as Windows CP-950. Traditional Chinese, similar to Big5.
Read strings as UTF-8.
Read strings as little-endian UTF-16.
Read strings as big-endian UTF-16.
Read strings in an encoding appropriate for Neverwinter Nights.
Read strings in an encoding appropriate for Neverwinter Nights 2.
Read strings in an encoding appropriate for Knights of the Old Republic.
Read strings in an encoding appropriate for Knights of the Old Republic II.
Read strings in an encoding appropriate for Jade Empire.
Read strings in an encoding appropriate for The Witcher.
Read strings in an encoding appropriate for Dragon Age: Origins.
Read strings in an encoding appropriate for Dragon Age II.
The TLK file to convert.
The XML file will be written there. If no output file is specified, the XML data is written to
stdout. The encoding of the XML stream is always UTF-8.
Convert the CP-1252 TLK
file1.tlk into an XML file:
$ tlk2xml --cp1252 file1.tlk file2.xml
Convert the UTF-16LE TLK
file1.tlk into an XML file on
$ tlk2xml --utf16le file1.tlk
Convert the TLK
file1.tlk from Neverwinter Nights into an XML file:
$ tlk2xml --nwn file1.tlk file2.xml
Convert the UTF-8 TLK
file1.tlk into an XML file on
stdout, modify it using sed(1) and use xml2tlk(1) to write it back into a TLK:
$ tlk2xml --utf8 file1.tlk | sed -e 's/gold/candy/g' | xml2tlk \ --utf8 --version30 file2.tlk
More information about the xoreos project can be found on its website.
This program is part of the xoreos-tools package, which in turn is part of the xoreos project, and was written by the xoreos team. Please see the
AUTHORS file for details.