1.0.1 • Published 6 months ago
linguai v1.0.1
A blazingly fast, deliciously simple way to generate translations for your applications using AI. Powered by GPT-4, linguai helps you translate your JSON locale files with minimal effort.
✨ Features
- 🚀 Lightning-fast AI-powered translations
- 🎯 Smart duplicate handling with side-by-side comparison
- 🌍 Support for multiple target languages
- 🤖 Powered by GPT-4 for high-quality translations
- 🛠️ Built with TypeScript for type safety
- 💾 Automatic environment configuration
- 🔄 Interactive translation management
🚀 Getting Started
# Install globally
npm install -g linguai
# Or run directly with npx
npx linguai
# Set up your project
linguai init
🔧 Configuration
Configure your translations in linguai.json
:
{
"version": "1.0.0",
"locale": {
"source": "en",
"targets": ["da", "sv", "no"] // Add any target languages
},
"files": {
"json": {
"include": ["src/locales/[locale].json"]
}
},
"openai": {
"model": "gpt-4" // Or use "gpt-3.5-turbo" for faster translations
}
}
🎯 Usage
Initialize a New Project
linguai init
Translate Your Files
# Translate to all configured languages
linguai translate
# Or translate to a specific language
linguai translate da
Managing Duplicates
When translating, linguai smartly handles existing translations:
- Shows side-by-side comparison of differences
- Offers options to:
- 🔍 Choose for each translation individually
- 💾 Keep all existing translations
- 🔄 Use all new translations
Environment Setup
linguai automatically manages your OpenAI API key:
- Checks
.env
and.env.local
files - Securely prompts for key if not found
- Optionally saves to
.env.local
- Automatically adds
.env.local
to.gitignore
🤝 Contributing
Got ideas? Found a bug? We're all ears!
- Fork it
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
📝 License
MIT - do whatever you want! See LICENSE for more details.
Made with ❤️ by Ludvig Lundh