ai_translation_generator 1.0.2 copy "ai_translation_generator: ^1.0.2" to clipboard
ai_translation_generator: ^1.0.2 copied to clipboard

A professional CLI tool for AI-powered translation generation using Google's Gemini AI. Generate Flutter l10n files with ease.

AI Translation Generator #

pub package License: 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 #

Global Installation #

dart pub global activate ai_translation_generator

Local Development #

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
  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)

export GEMINI_API_KEY=your_gemini_api_key_here

Option B: .env File

# Create .env file in your project root
echo "GEMINI_API_KEY=your_gemini_api_key_here" > .env

๐Ÿš€ Quick Start #

1. Initialize Configuration #

aitranslation init

This creates a ai_translation_generator.yaml file:

# 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:

languages:
  - en
  - ar
  - es
  - fr
  - de
  - ja
  - ko

strings:
  - settings
  - home
  - profile
  - logout
  - login
  - register
  - dashboard
  - notifications
  - search
  - filter

3. Generate Translations #

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:

{
  "settings": "ุฅุนุฏุงุฏุงุช",
  "home": "ุงู„ุฑุฆูŠุณูŠุฉ",
  "profile": "ุงู„ู…ู„ู ุงู„ุดุฎุตูŠ",
  "logout": "ุชุณุฌูŠู„ ุงู„ุฎุฑูˆุฌ"
}

lib/l10n/es.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 #

aitranslation init

Creates the default configuration file.

Generate Translations #

aitranslation generate

Generates translations for all configured languages.

Help #

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 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 for details.

Development Setup #

git clone https://github.com/FUZAIL-GIT/ai_translation_generator.git
cd ai_translation_generator
dart pub get
dart test

Running Tests #

dart test

๐Ÿ“„ License #

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments #

  • Google Gemini AI for providing the translation API
  • Flutter l10n for the localization standard
  • The Dart community for excellent tooling and packages

๐Ÿ“ž Support #

๐Ÿ—บ๏ธ 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

0
likes
160
points
129
downloads

Publisher

unverified uploader

Weekly Downloads

A professional CLI tool for AI-powered translation generation using Google's Gemini AI. Generate Flutter l10n files with ease.

Repository (GitHub)
View/report issues
Contributing

Documentation

API reference

License

MIT (license)

Dependencies

args, cli_util, dotenv, http, io, path, yaml

More

Packages that depend on ai_translation_generator