slang_it 0.0.4
slang_it: ^0.0.4 copied to clipboard
CLI tool for automatic localization extraction and code transformation for slang. Write slang_it.key'text' and it automatically becomes t.key.
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.
0.0.1 - 2025-10-11 #
Added #
- Initial release of slang_it CLI tool
- Core functionality to extract translations from
slang_it.key'text'patterns in Dart code - Automatic JSON generation in
lib/i18n/{locale}.i18n.jsonformat - Automatic execution of
dart run slangto generate translation files - Automatic code transformation from
slang_it.key'text'tot.key - Smart import management - automatically adds
import '../i18n/strings.g.dart' - Command-line interface with multiple modes:
- Basic mode:
dart run slang_it - Watch mode:
dart run slang_it --watchfor continuous development - Dry-run mode:
dart run slang_it --dry-runto preview changes - Backup mode:
dart run slang_it --backupto create.bakfiles - Interactive mode:
dart run slang_it --interactivefor confirmation prompts
- Basic mode:
- Configuration file support via
slang_it.yaml - Support for nested translation keys (e.g.,
home.settings.title) - Proper handling of escaped quotes in translation strings
- Relative import path calculation that works at any directory depth
- Exclusion patterns for generated files (
.g.dart,.freezed.dart, etc.) - Deep merge strategy that preserves existing manual edits in JSON files
- Multi-line pattern support for code formatted across lines
- File watcher for watch mode using
DirectoryWatcher
Features #
- Zero-config operation: Works immediately with sensible defaults
- Smart import insertion: Places imports after existing imports, before code
- Translation preservation: Never overwrites manual JSON edits
- Performance optimized: Early exit when files don't contain slang_it patterns
- Comprehensive error handling: Graceful recovery from invalid JSON, malformed patterns
- User-friendly output: Clear progress messages and success confirmations
Documentation #
- Complete README with installation, usage, and examples
- Inline code documentation with detailed comments explaining every line
- Configuration examples and customization guide
- Troubleshooting section
- FAQ addressing common questions
Technical Details #
- Regex-based pattern matching for
slang_it.key'text'extraction - Nested map generation for hierarchical JSON structure
- Atomic file operations for safe source code modification
- Support for both single and double quoted strings
- Proper escaping/unescaping of special characters
0.0.2 - 2025-10-25 #
Added #
- Multi-locale file update support - automatically updates translation files for multiple locales simultaneously