smart_arb_translator 1.1.0
smart_arb_translator: ^1.1.0 copied to clipboard
An intelligent command-line utility for translating ARB files with Google Translate API, featuring smart change detection and modular architecture.
Changelog #
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
1.1.0 - 2024-12-19 #
Added #
- ⚙️ pubspec.yaml Configuration Support: Configure all parameters directly in your
pubspec.yamlfile under thesmart_arb_translatorsection - 📋 Complete Parameter Coverage: All CLI arguments can now be set in pubspec.yaml configuration
- 🔄 Configuration Precedence System: CLI arguments take precedence over pubspec.yaml settings, which take precedence over defaults
- 🎯 Flexible Language Code Formats: Support for both YAML list format (
[es, fr, de]) and comma-separated strings ("es,fr,de") - 🛡️ Graceful Error Handling: Robust handling of malformed YAML configurations
- 📚 Comprehensive Documentation: Updated README with configuration examples and best practices
- 🧪 Full Test Coverage: 13 new tests covering pubspec configuration and argument parser integration
Enhanced #
- 🔧 Developer Experience: Simple
smart_arb_translatorcommand when using pubspec.yaml configuration - 👥 Team Consistency: Version-controlled configuration ensures all team members use the same settings
- 🚀 CI/CD Integration: Simplified build scripts with configuration stored in pubspec.yaml
- 🔄 Backward Compatibility: Existing CLI usage continues to work unchanged
- 📖 IDE Support: Better tooling integration with YAML configuration
Technical Details #
- New Classes:
PubspecConfig: Handles reading and parsing pubspec.yaml configuration_MergedArgResults: Custom ArgResults implementation for merging CLI and pubspec settings
- Configuration Options: All 13 CLI parameters now supported in pubspec.yaml:
source_dir/source_arb: Source configurationapi_key: Google Translate API key pathlanguage_codes: Target languages (list or comma-separated)cache_directory/l10n_directory: Directory configurationoutput_file_name: Output file naminggenerate_dart/dart_class_name/dart_output_dir/dart_main_locale: Dart generationl10n_method: Localization method selectionauto_approve: Automation settings
Usage Examples #
# pubspec.yaml
smart_arb_translator:
source_dir: lib/l10n
api_key: secrets/google_translate_api_key.txt
language_codes: [es, fr, de, ja]
generate_dart: true
dart_class_name: AppLocalizations
# Simple command - all configuration from pubspec.yaml
smart_arb_translator
# Override specific parameters if needed
smart_arb_translator --language_codes it,pt --generate_dart false
Benefits #
- ✅ Version Control Friendly: Configuration committed with your code
- ✅ Team Consistency: Everyone uses the same settings
- ✅ No Command Memorization: Simple command execution
- ✅ IDE Integration: Better tooling support
- ✅ Cleaner CI/CD: Simplified build scripts
1.0.1 - 2024-05-26 #
Added #
- 🎯 Dual Localization Method Support: Choose between Flutter's built-in
gen-l10norintl_utilspackage - 🤖 Intelligent Auto-Detection: Automatically detects existing localization setup and chooses the appropriate method
- 📝 Auto-Configuration: Automatically creates
l10n.yamlor configurespubspec.yamlbased on chosen method - 🔧 Method Selection: New
--l10n_methodparameter to explicitly choose betweengen-l10nandintl_utils - 💾 Preference Persistence: Saves user's localization method choice in
pubspec.yamlfor future runs - ✅ Auto-Approve Option: New
--auto_approveflag to automatically approve configuration changes
Enhanced #
- 🧠 Smart Method Detection: Automatically detects:
- Existing
l10n.yamlfile → Usesgen-l10n - Existing
intl_utilsdependency orflutter_intlconfig → Usesintl_utils - Saved preference in
pubspec.yaml→ Uses saved method - No setup found → Prompts user to choose (or defaults to
intl_utilswith--auto_approve)
- Existing
- 🔄 Flutter gen-l10n Integration: Full support for Flutter's official localization solution
- 📋 Interactive Setup: User-friendly prompts when no existing setup is detected
- 🛡️ Safe Configuration: Asks for permission before modifying project files (unless auto-approved)
Technical Details #
- New Command Options:
--l10n_method: Choose betweengen-l10norintl_utils--auto_approve: Automatically approve configuration changes
- Auto-Configuration Features:
- Creates
l10n.yamlwith proper paths and class names forgen-l10n - Adds
intl_utilsdependency andflutter_intlconfig forintl_utils - Preserves existing file formatting and comments
- Creates
- Intelligent Detection Logic: Comprehensive project analysis to determine the best localization method
Usage Examples #
# Auto-detect and configure (interactive)
smart_arb_translator --source_dir lib/l10n --api_key api_key.txt --language_codes es,fr --generate_dart
# Force specific method
smart_arb_translator --source_dir lib/l10n --api_key api_key.txt --language_codes es,fr --generate_dart --l10n_method gen-l10n
# Auto-approve configuration changes
smart_arb_translator --source_dir lib/l10n --api_key api_key.txt --language_codes es,fr --generate_dart --auto_approve
1.0.0 - 2024-01-01 #
Added #
- 🎉 Initial release of Smart ARB Translator
- ✨ Smart Change Detection: Only translates modified or new content
- 🏗️ Modular Architecture: Refactored into clean, maintainable modules
- 📁 Batch Processing: Recursive directory translation support
- 🔄 Automatic Merging: Seamless l10n directory integration
- 🎯 Manual Translation Override: Support for
@x-translationsmetadata - 🛠️ Flexible Output: Customizable file naming and directory structure
- 🚨 Robust Error Handling: Detailed feedback and error messages
- 📚 Comprehensive Documentation: Complete README with examples
- 🧪 Programmatic API: Use as a library in your Dart projects
Changed #
- 🔄 Package Name: Renamed from
arb_translatortosmart_arb_translator - 🏗️ Architecture: Complete refactor into modular components:
TranslationService: Google Translate API integrationArbProcessor: ARB file processing and action managementFileOperations: File and directory utilitiesDirectoryProcessor: Batch directory processingSingleFileProcessor: Individual file processing with change detectionArbTranslatorArgumentParser: Command-line argument handlingConsoleUtils: Console output utilities
- 🎨 CLI Interface: Improved command-line experience
- 📦 Dependencies: Updated to latest package versions
Enhanced #
- 🧠 Intelligence: Smart detection of changes to minimize API calls
- ⚡ Performance: Optimized processing for large projects
- 🔧 Maintainability: Clean separation of concerns
- 📖 Documentation: Comprehensive guides and examples
- 🎯 User Experience: Better error messages and feedback
Technical Details #
- Minimum Dart SDK: 3.0.1
- Dependencies: Updated all dependencies to latest versions
- Architecture: Modular design with clear separation of concerns
- Testing: Foundation for comprehensive test coverage
- Documentation: Complete API documentation and usage examples
Migration from arb_translator #
If you're migrating from the original arb_translator package:
-
Update pubspec.yaml:
dev_dependencies: smart_arb_translator: ^1.0.0 # instead of arb_translator -
Update command usage:
smart_arb_translator # instead of pub run arb_translator:translate -
Argument changes:
--append-lang-code/--no-append-lang-code(instead of--append_lang_code)- All other arguments remain the same
-
New features available:
- Smart change detection (automatic)
- Improved error handling
- Better performance
- Programmatic API access
Acknowledgments #
- Originally forked from justkawal/arb_translator
- Enhanced with modern architecture and smart features
- Built for the Flutter community
Note: This is the first release of Smart ARB Translator as a standalone package. Future releases will follow semantic versioning with detailed changelogs.