Preserve component imports - Any import statements at the top
Step 3: Translate JSON Keys
In messages/{locale}.json, translate the "book" section. Key areas:
Book Metadata
"book":{"title":"The Interactive Book of Prompting","subtitle":"An Interactive Guide to Crafting Clear and Effective Prompts","metaTitle":"...","metaDescription":"...",
...
}
Localize example text for demos (tokenizer samples, temperature examples, etc.):
"demoExamples":{"tokenPrediction":{"tokens":["The"," capital"," of"," France"," is"," Paris","."],"fullText":"The capital of France is Paris."},"temperature":{"prompt":"What is the capital of France?",
...
}}
Book Elements Locales (REQUIRED)
⚠️ DO NOT SKIP THIS STEP - The interactive demos will not work in the new language without this.
Translate the locale data file at src/components/book/elements/locales/{locale}.ts:
Temperature examples, token predictions, embedding words
Then register it in src/components/book/elements/locales/index.ts:
import {locale} from"./{locale}";
constlocales: Record<string, LocaleData> = {
en,
tr,
az,
{locale}, // Add your new locale here
};
export { en, tr, az, {locale} }; // Add to exports
Translate all interactive component labels and navigation strings.
Step 4: Verify Translation
Run the check script:
node scripts/check-translations.js
Start dev server and test:
npm run dev
Navigate to /book with the target locale to verify content loads
Reference: English Translation
The English (en) translation is complete and serves as the base template for all new translations:
MDX files: src/content/book/*.mdx — copy this files to src/content/book/{locale}/*.mdx
JSON keys: messages/en.json → book section — use as reference for structure
Recommended Workflow
Copy src/content/book/*.mdx to src/content/book/{locale}/*.mdx
Copy the "book" section from messages/en.json to messages/{locale}.json. Translate these in multiple agentic session instead of single time (token limit may exceed at once)
Edit each file, translating English → target language
Keep all JSX components, code blocks, and Markdown syntax intact
Quality Guidelines
Consistency: Use consistent terminology throughout (e.g., always translate "prompt" the same way)
Technical terms: Some terms like "AI", "ChatGPT", "API" may stay in English
Cultural adaptation: Adapt examples to be relevant for the target audience where appropriate
Natural language: Prioritize natural-sounding translations over literal ones