Quick Start
Translate your first locale file in 60 seconds.
1. Set Up Your Locale Files
Create a source locale file. Rosetta supports JSON, TOML, and YAML:
locales/en.json
{
"hero": {
"title": "Welcome to our platform",
"subtitle": "Build something amazing"
},
"nav": {
"home": "Home",
"about": "About",
"contact": "Contact"
}
}
2. Set Your API Key
export OPENROUTER_API_KEY=sk-or-v1-...
3. Run Sync
npx i18n-rosetta sync
Rosetta will:
- Auto-detect
locales/en.jsonas the source - Find (or prompt for) target languages
- Translate all keys
- Write
locales/fr.json,locales/ja.json, etc. - Create
.i18n-rosetta.lockto track what's been translated
4. Check the Results
cat locales/fr.json
{
"hero": {
"title": "Bienvenue sur notre plateforme",
"subtitle": "Construisez quelque chose d'incroyable"
},
"nav": {
"home": "Accueil",
"about": "À propos",
"contact": "Contact"
}
}
What Happens Next?
When you change a source string, rosetta detects the change via SHA-256 hash tracking and re-translates only that key on the next sync:
locales/en.json (updated)
{
"hero": {
"title": "Welcome to Acme Platform", // ← changed
"subtitle": "Build something amazing" // ← unchanged, skipped
}
}
npx i18n-rosetta sync
# Only "hero.title" is re-translated across all locales
Optional: Create a Config File
For more control, generate a config file:
npx i18n-rosetta init
Or create one manually:
i18n-rosetta.config.json
{
"version": 3,
"inputLocale": "en",
"localesDir": "./locales",
"model": "openai/gpt-4o-mini"
}
Optional: Watch Mode
Auto-translate when your source file changes:
npx i18n-rosetta watch
Next Steps
- Configuration — Full config reference
- Translation Methods — Choose the right method
- Framework Integration — Hugo, next-intl, react-i18next
- CI/CD — Automate translations in your pipeline