https://github.com/fuzail-git/ai_translation_generator
Professional CLI tool for AI-powered translation generation using Google's Gemini AI. Generate Flutter l10n files with ease and support for 100+ languages.
https://github.com/fuzail-git/ai_translation_generator
ai artificial-intelligence auto automation cli clitool dart dart-package flutter gemini generator il8n internationalization l10n localized open-source pub tools translation
Last synced: about 1 month ago
JSON representation
Professional CLI tool for AI-powered translation generation using Google's Gemini AI. Generate Flutter l10n files with ease and support for 100+ languages.
- Host: GitHub
- URL: https://github.com/fuzail-git/ai_translation_generator
- Owner: FUZAIL-GIT
- License: mit
- Created: 2025-10-02T17:14:02.000Z (9 months ago)
- Default Branch: dev
- Last Pushed: 2025-10-02T18:10:53.000Z (9 months ago)
- Last Synced: 2026-05-13T02:47:33.588Z (about 1 month ago)
- Topics: ai, artificial-intelligence, auto, automation, cli, clitool, dart, dart-package, flutter, gemini, generator, il8n, internationalization, l10n, localized, open-source, pub, tools, translation
- Language: Dart
- Homepage:
- Size: 31.3 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# AI Translation Generator
[](https://pub.dev/packages/ai_translation_generator)
[](https://opensource.org/licenses/MIT)
A professional CLI tool for AI-powered translation generation using Google's Gemini AI. Generate Flutter l10n files with ease and support for multiple languages.
## โจ Features
- ๐ **Easy Setup**: Initialize with a single command
- ๐ **Multi-language Support**: Translate to multiple languages simultaneously
- ๐จ **Professional CLI**: Beautiful terminal interface with progress indicators
- ๐ง **Flutter l10n Standard**: Generates files in `lib/l10n/` directory
- ๐ **Internet Connectivity**: Automatic connection checking and error handling
- โก **Fast & Efficient**: Optimized for speed with parallel processing
- ๐ **Secure**: No hardcoded API keys, users provide their own
## ๐ฆ Installation
### Prerequisites
- [Dart SDK](https://dart.dev/get-dart) version 3.8.1 or higher
### Global Installation
```bash
dart pub global activate ai_translation_generator
```
### Local Development
```bash
git clone https://github.com/FUZAIL-GIT/ai_translation_generator.git
cd ai_translation_generator
dart pub get
dart compile exe bin/ai_translation_generator.dart -o aitranslation
```
## ๐ API Key Setup
### Get Your Free Gemini API Key
1. Visit [Google AI Studio](https://makersuite.google.com/app/apikey)
2. Sign in with your Google account
3. Generate a free API key (no credit card required)
### Configure Your API Key
**Option A: Environment Variable (Recommended)**
```bash
export GEMINI_API_KEY=your_gemini_api_key_here
```
**Option B: .env File**
```bash
# Create .env file in your project root
echo "GEMINI_API_KEY=your_gemini_api_key_here" > .env
```
## ๐ Quick Start
### 1. Initialize Configuration
```bash
aitranslation init
```
This creates a `ai_translation_generator.yaml` file:
```yaml
# AI Translation Generator Configuration
# Generated by aitranslation init
languages:
- en
- ar
strings:
- settings
- home
- profile
- logout
```
### 2. Customize Your Configuration
Edit `ai_translation_generator.yaml` to add your strings and target languages:
```yaml
languages:
- en
- ar
- es
- fr
- de
- ja
- ko
strings:
- settings
- home
- profile
- logout
- login
- register
- dashboard
- notifications
- search
- filter
```
### 3. Generate Translations
```bash
aitranslation generate
```
### 4. Use in Your Flutter App
The tool generates Flutter l10n compatible files:
```
lib/l10n/
โโโ en.json
โโโ ar.json
โโโ es.json
โโโ fr.json
โโโ de.json
```
## ๐ Output Format
### Generated Files
**lib/l10n/ar.json:**
```json
{
"settings": "ุฅุนุฏุงุฏุงุช",
"home": "ุงูุฑุฆูุณูุฉ",
"profile": "ุงูู
ูู ุงูุดุฎุตู",
"logout": "ุชุณุฌูู ุงูุฎุฑูุฌ"
}
```
**lib/l10n/es.json:**
```json
{
"settings": "configuraciรณn",
"home": "inicio",
"profile": "perfil",
"logout": "cerrar sesiรณn"
}
```
## ๐ Security & Privacy
- โ
**No hardcoded API keys** - The package doesn't contain any API keys
- โ
**User-specific keys** - Each user provides their own free Gemini API key
- โ
**Secure storage** - Keys are stored in environment variables or .env files
- โ
**Local processing** - API keys never leave your machine
- โ
**Open source** - Full transparency in the codebase
## ๐ ๏ธ Commands
### Initialize
```bash
aitranslation init
```
Creates the default configuration file.
### Generate Translations
```bash
aitranslation generate
```
Generates translations for all configured languages.
### Help
```bash
aitranslation --help
```
Shows available commands and usage information.
## ๐๏ธ Architecture
```
lib/
โโโ models/
โ โโโ translation_config.dart # Configuration model
โโโ services/
โ โโโ config_service.dart # Configuration management
โ โโโ gemini_service.dart # Gemini API integration
โ โโโ translation_service.dart # Translation orchestration
โโโ commands/
โ โโโ init_command.dart # Init command
โ โโโ generate_command.dart # Generate command
โโโ utils/
โโโ cli_utils.dart # CLI utilities and formatting
```
## ๐ Configuration
### Language Codes
Use standard ISO 639-1 language codes:
- `en` - English
- `ar` - Arabic
- `es` - Spanish
- `fr` - French
- `de` - German
- `ja` - Japanese
- `ko` - Korean
- `zh` - Chinese
- `pt` - Portuguese
- `ru` - Russian
### Supported Languages
The tool supports 100+ languages through Google's Gemini AI. See the [full list](https://cloud.google.com/translate/docs/languages) for all supported language codes.
## ๐จ Error Handling
The tool includes comprehensive error handling:
- โ
**Internet connectivity checks**
- โ
**Configuration validation**
- โ
**API error handling**
- โ
**File system error handling**
- โ
**Clear error messages with suggestions**
### Common Issues
**API Key Not Found:**
```
GEMINI_API_KEY not found. Please set it using one of these methods:
1. Environment variable: export GEMINI_API_KEY=your_api_key_here
2. .env file: Create .env file in project root with GEMINI_API_KEY=your_api_key_here
```
**No Internet Connection:**
```
No internet connection. Please check your network and try again.
```
## ๐ค Contributing
We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
### Development Setup
```bash
git clone https://github.com/FUZAIL-GIT/ai_translation_generator.git
cd ai_translation_generator
dart pub get
dart test
```
### Running Tests
```bash
dart test
```
## ๐ License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## ๐ Acknowledgments
- [Google Gemini AI](https://ai.google.dev/) for providing the translation API
- [Flutter l10n](https://docs.flutter.dev/development/accessibility-and-localization/internationalization) for the localization standard
- The Dart community for excellent tooling and packages
## ๐ Support
- ๐ [Documentation](https://github.com/FUZAIL-GIT/ai_translation_generator#readme)
- ๐ [Report Issues](https://github.com/FUZAIL-GIT/ai_translation_generator/issues)
- ๐ฌ [Discussions](https://github.com/FUZAIL-GIT/ai_translation_generator/discussions)
- โญ [Star the Project](https://github.com/FUZAIL-GIT/ai_translation_generator)
## ๐บ๏ธ Roadmap
- [ ] Support for more AI models (OpenAI, Claude)
- [ ] Batch processing optimization
- [ ] Custom prompt templates
- [ ] Translation quality scoring
- [ ] Integration with popular Flutter packages
- [ ] VS Code extension
- [ ] Web interface
---
Made with โค๏ธ for the Flutter community