Skip to main content

Module loc

Module loc 

Source
Expand description

Localisation table files for Total War games.

Loc files store key-value pairs for text localisation, enabling translation of in-game strings. Each entry consists of a unique key, the localised text, and a boolean flag (purpose unknown, commonly called “tooltip”).

§Overview

Unlike DB tables which require schema definitions, Loc files have a fixed structure:

  • Key: Unique identifier for the text entry (UTF-16 string)
  • Text: The localised string content (UTF-16 string)
  • Tooltip: Boolean flag of unknown purpose

Loc files are used in all Total War games since Empire. In games prior to Troy, when using a non-English language, only the main localisation.loc file is loaded - individual loc files are ignored.

§Binary Structure

§Header (14 bytes)

BytesTypeData
2u16Byte order mark. Always 0xFFFE.
3UTF-8 StringFile type identifier. Always "LOC".
1u8Unknown, always 0. Possibly padding.
4i32Version. Always 1 in known files.
4u32Number of entries in the table.

§Data (per entry)

BytesTypeData
2 + *Sized StringU16Localisation key (u16 length prefix + UTF-16).
2 + *Sized StringU16Localised text (u16 length prefix + UTF-16).
1boolTooltip flag (unknown purpose).

Structs§

Loc
In-memory representation of a decoded Loc (localisation) file.

Constants§

EXTENSION
Extension used by Loc files.