AI-powered translation synchronization tool. Automatically detects missing translations and uses OpenAI to translate them while preserving formatting and placeholders.
npm install linguaisync- Set OpenAI API key
export OPENAI_API_KEY="sk-your-api-key"- Create
linguaisync.config.js
const path = require('path');
module.exports = {
localesDir: path.join(__dirname, 'public/locales'),
baseLanguage: 'en',
translationFiles: ['translation.json'],
};- Directory structure
locales/
├── en/
│ └── translation.json
└── es/
└── translation.json
- Run
# Preview changes
npx linguaisync --all --dry-run
# Sync all languages
npx linguaisync --all
# Sync specific languages
npx linguaisync --lang es,fr,delinguaisync --all # Process all languages
linguaisync --lang es,fr # Process specific languages
linguaisync --all --dry-run # Preview without changes
linguaisync --all --dry-run --verbose # Show detailed output
linguaisync --all --dry-run --output missing.json # Export to file
linguaisync --config custom.js # Use custom config
linguaisync --locales-dir ./i18n # Override locales pathJavaScript config (linguaisync.config.js):
const path = require('path');
module.exports = {
localesDir: path.join(__dirname, 'public/locales'),
baseLanguage: 'en',
translationFiles: ['translation.json', 'common.json'],
batchSize: 20,
model: 'gpt-4o-mini',
temperature: 0.3,
};JSON config (linguaisync.config.json):
{
"localesDir": "./public/locales",
"baseLanguage": "en",
"translationFiles": ["translation.json"],
"batchSize": 20
}const { createConfig, syncLanguages, analyzeLanguages } = require('linguaisync');
const config = createConfig({
localesDir: './locales',
baseLanguage: 'en',
});
// Analyze (dry run)
const missing = analyzeLanguages(config, ['es', 'fr'], true);
// Sync translations
await syncLanguages(config, ['es', 'fr']);| Language | Code | Language | Code | Language | Code |
|---|---|---|---|---|---|
| Arabic | ar | German | de | Japanese | jp |
| Bulgarian | bg | Greek | el | Korean | ko |
| Chinese | zh | Indonesian | id | Dutch | nl |
| Danish | da | Italian | it | Norwegian | no |
| Spanish | es | Polish | pl | Ukrainian | ua |
| Finnish | fi | Portuguese | pt | Vietnamese | vi |
| French | fr | Romanian | ro | ||
| Russian | ru | ||||
| Slovenian | sl | ||||
| Swedish | sv | ||||
| Turkish | tr |
Add to package.json:
{
"scripts": {
"i18n:check": "linguaisync --all --dry-run --verbose",
"i18n:sync": "linguaisync --all"
}
}- 🤖 AI-powered translations via OpenAI
- 🔄 Automatic missing key detection
- 🎯 Smart batching for API efficiency
- 📦 Multi-file support
- 🔑 Preserves placeholders (
{{var}}) and HTML - 🧪 Dry run mode
- 💾 Export to JSON
This project is licensed under the MIT License.
- tududi - Productivity made simple
- Reconya - Network reconnaissance and asset discovery tool
- BreachHarbor - Cybersecurity suite for digital asset protection
- Hevetra - Digital tracking for child health milestones
README created by Chris Veleris for linguAIsync.
