Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Format:Godot optimized translation

From ReverseEngineering.wiki
Format
Engine Library:Godot Engine
Extensions .translation (Unverified)
License MIT
On this wiki Facts · Code · Notes · Topics

Godot's compact compiled translation resource (OptimizedTranslation, often a .translation file): a hash table, a bucket table and a string blob in which messages are stored UTF-8, optionally smaz-compressed, looked up by a two-level FNV-style hash of the source text; context and plurals are not supported.

Identification

OptimizedTranslation is a Translation resource with three properties: hash_table (array of 32-bit ints), bucket_table (array of 32-bit ints) and strings (bytes). There is no plain-text content: source texts are not stored, only 32-bit hashes of them, so the original keys cannot be recovered from the file. Unverified: that the resource is saved as .translation and what its binary resource wrapper looks like (the engine source read here defines the class, not the file extension or the RSRC layout); open a sample in a Godot-aware tool or check the exporter.

Lookup

h = hash(0, text); hash_table[h % size] gives an index into bucket_table or 0xFFFFFFFF for no entry. The bucket is: i32 element count, u32 hash function seed func, then count elements of four u32: key, str_offset, comp_size, uncomp_size. The key is hash(func, text); find the element whose key matches. The message is the strings blob at str_offset: if comp_size equals uncomp_size it is plain UTF-8, otherwise it is compressed with smaz (a short-string compressor bundled in the engine's thirdparty folder) and uncomp_size is the length after decompressing.

The hash: p_d starts at 0x1000193 if the seed is 0; for each byte, p_d = (p_d * 0x1000193) ^ byte (32-bit). The generator increments the per-bucket seed starting at 1 until all keys in a bucket have distinct hashes; the table size is a prime at least the number of messages.

Limits

Context (msgctxt, stored as context + 0x04 + id in normal translations) and plural forms are not supported: messages with a context are skipped with a warning when the resource is generated, and get_plural_message just returns the singular. An empty message is stored as a single null byte.

Recovering text

Because only hashes are stored, extract the translated strings by walking every bucket (the engine's get_translated_message_list does exactly this) and match them to source keys with the project's original CSV or PO files.

Code & repositories

  • https://github.com/godotengine/godot @ 81ab961f91066a63bcbf3ec340962bb1a1ada558 · license: MIT
    Godot engine; core/string/optimized_translation.* implements the compact translation resource.
    Tested on: source read, not run: source read, not built or run · checked 2026-10-19; last activity 2026-10-18; Note: the latest release ships binaries; the wiki links only the source, never the binaries

Evidence & references

godotengine/godot (MIT) core/string/optimized_translation.h and .cpp, and translation.cpp for the 0x04 context separator; see the attached facts.