English
Translate a pack
Your pack is in English and you want French players to read it in French.
Solution
Every text of a pack is an object with one key per language. Add fr next to each en:
quests.json
json
{ "en": "Tidy the downloads", "fr": "Range les téléchargements" }examples/quest-pack/core.fragment.json#/quests/0/title
To find the texts you missed, save this script as missing-fr.mjs (it needs nothing but Node) and run it on each file:
missing-fr.mjs
js
// Lists every text of a content file that has English but no French, with where it is.
// Usage: node missing-fr.mjs my-pack/quests.json
import { readFileSync } from "node:fs";
const file = process.argv[2] ?? "my-pack/quests.json";
const missing = [];
(function walk(value, at) {
if (Array.isArray(value)) return value.forEach((v, i) => walk(v, `${at}[${i}]`));
if (!value || typeof value !== "object") return;
if (typeof value.en === "string" && typeof value.fr !== "string") missing.push(`${at}: "${value.en}"`);
for (const [k, v] of Object.entries(value)) walk(v, at ? `${at}.${k}` : k);
})(JSON.parse(readFileSync(file, "utf8")), "");
console.log(missing.length ? missing.join("\n") : `every text of ${file} has its French`);
process.exitCode = missing.length ? 1 : 0;examples/recipes/missing-fr.mjs
Terminal
sh
node missing-fr.mjs my-pack/quests.jsonOutput, first lines
text
quests[0].title: "My Pack: first steps"
quests[0].summary: "Replace this text: what the player learns here."
quests[0].steps[0].title: "Read what this pack is about"
quests[0].steps[1].title: "Pick a pace"Each line is a text without French, and where it is. Once every text has its French, the script says so and exits with 0.
How it works
The game speaks English and French. It shows each text in the player's language, and the English one when that language is missing, so a half-translated pack still works. alta lint does not report a missing translation; the script does, with the path of each text in the file. Address the player with "tu" in French, as the game does.
Variants
- In CI. Add
node missing-fr.mjs <file>afteralta lintin your workflow: it fails the job when a text has no French. See Check a repository in GitHub Actions. - Other languages. The game speaks English and French only for now; another key is kept in the file but never shown.
- With an agent. The author MCP reads and writes the same files: ask your agent to add the French and run the check.