module documentation
Read and write TLK (Talk Table) files (for translation and base game string references).
All strings are transparently converted to and from the NWN encoding.
| Class | |
A single entry in a TLK file including the text, sound resref, and sound length. Only used when reading TLK files with sound data. |
| Function | read |
Reads a TLK file fully into memory and returns a list of entries. |
| Function | write |
Writes a Tlk object to a binary file. |
Reads a TLK file fully into memory and returns a list of entries.
| Parameters | |
file:BinaryIO | A binary file object containing the TLK file. |
| max | The maximum number of entries to read from the TLK file. This is a sanity check to avoid allocating excess memory when reading untrusted or corrupted data. |
| Returns | |
tuple[ | A tuple containing the list of entries, and the language of the TLK file. |
| Raises | |
ValueError | If the file does not contain valid TLK data. |
Writes a Tlk object to a binary file.
| Parameters | |
file:BinaryIO | A binary file object to write the TLK data to. |
entries:list[ | A list containing the entries to write, in order. Entries can be either strings or Entry objects. |
language:Language | The language of the TLK file to write. |
| Raises | |
ValueError | If the TLK object contains invalid data. |