A practical automation tool that automatically translates CK3 localization files using the DeepL API and TypeScript, while preserving in-game custom tags.
Category
Tool
Status
Completed
GitHub Stats
Created
May 10, 2025
Last Updated
May 10, 2025
In this project, I developed a TypeScript-based automation tool for batch translating Crusader Kings 3 localization files.
Manually translating CK3 localization files line by line is both slow and prone to errors. I specifically addressed the need to produce translations without corrupting the in-game custom tags within numerous .yml files.
I established a workflow within the main script that iterates through the loc folder and processes all .yml files. When translating with the DeepL API, I first extracted and then reinserted patterns such as square brackets, variables, line breaks, and in-game custom placeholders. Translated lines were marked with the tag # Translated!, a retry logic was added for request limit errors, and two helper scripts were prepared for tagging and merging operations.
The outcome is a practical tool that accelerates the CK3 translation process and reduces repetitive work. I consolidated not only the main translation but also the tagging and file merging aspects within the same repository.
TypeScript, Node.js, Axios, dotenv, fs-extra, DeepL API, ESLint, Prettier