finish-language-with-ai maps the English string the AI translated back to the key it belongs to, but the map was keyed on the English string, so when two keys in a section share one - [Graphics] "Texture Filter" and "Texture Filtering", [Error] "Error reading file" and "The file is not a valid zip file" - only the last one survived and the other silently never got its translation. Map to a list of keys instead and update all of them, and stop sending the same line to the AI twice while we're at it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0164UKoXpz9r155TRfQsoc3H
Language ini file processor tool
To install Rust and cargo, go here.
To run, with rust installed, change to this Tools/langtool directory, then:
cargo run
(Or just move the binary out of target/ and run it directly).
To see command line usage, type:
cargo run -- --help
Validating
cargo run -- validate
Checks every translated string in every language file against the English one it came from:
placeholders (%1, %d, ...) must survive translation, no line breaks or stray quotes, nothing
empty. Exits with a non-zero code if it finds anything, so it can be used as a check in a script.
The same checks run on anything the AI produces, before it gets written to a file.
AI translation
Some commands (add-new-key-ai, add-new-key-value-ai, finish-language-with-ai) use an LLM to
generate translations. Two providers are supported, pick one by setting its API key in the
environment:
- Claude (Anthropic):
ANTHROPIC_API_KEY - OpenAI:
OPENAI_API_KEY
If both are set, Claude is used unless you say otherwise with --provider openai. To pick a
specific model, use --model, for example:
cargo run -- --model claude-sonnet-5 finish-language-with-ai sv_SE
cargo run -- --model gpt-4o finish-language-with-ai sv_SE
The provider is inferred from the model name, so --provider is only needed to disambiguate.
To autoformat the code, use:
cargo fmt
or set up your IDE to do that (it's already pre-set-up for VS Code, if you open the langtool folder directly).