flutter_hardcode_localizer 1.0.5
flutter_hardcode_localizer: ^1.0.5 copied to clipboard
A Dart plugin that finds hardcoded strings in Flutter projects and provides quick-fix to move them to localization files for easy_localization.
Changelog #
1.0.5 - 2025-08-19 #
πUnnecessary localisation of dart statements will be ignored
- β Import Statements [ import 'widgets/sample_widget.dart'; import 'dart:io'; import 'string_utils.dart'; & so on]
- β Assertions [test cases assertions will be skipped]
- β Annotations [any type of annotations used by flutter/dart plugins/packages]
1.0.4 - 2025-08-18 #
πNew Tool features added #
additional optional arguments added for CLI tool
dart run flutter_hardcode_localizer:localize \
--targetPath example \
--skipFiles lib/widgets/skip_file_1.dart,lib/widgets/skip_file_2.dart \
--autoApproveSuggestedKeys true
--targetPath
(Optional) Path to your projectβs target directory.
--autoApproveSuggestedKeys
(Optional, true/false) Automatically approve suggested JSON keys without developer consent.
--skipFiles
(Optional) Comma-separated list of file paths to skip during processing.
lib/ui/theme/codegen_key.g.dart will be skipped automatically, no need to manually add this in skipFiles array
1.0.3 - 2025-08-18 #
πReviewed Pub.dev Analysis #
New Features
- β Added Example
- β Platform support constraints updated
- β Developer Comments added for classes
1.0.1 - 2025-08-14 #
π Enhanced for easy_localization Integration #
New Features
- β
LocaleKeys.key.tr() Format: Changed replacement format from
Locale.$keytoLocaleKeys.$key.tr() - β easy_localization Workflow: Perfect integration with the popular easy_localization package
- β Automated JSON Key-Value Creation: Eliminates manual process of adding translations
- β
Standard Directory Structure: Uses
assets/languages/following easy_localization conventions - β Enhanced Documentation: Added specific command for LocaleKeys generation with correct parameters
Technical Changes
- JsonManager: Updated to use
assets/languages/en.jsoninstead oflang/en.json - Path Standardization: Follows easy_localization standard directory structure
- pubspec.yaml Integration: Clear instructions for adding assets directory
Enhanced Command Reference
The README now includes the specific command for generating LocaleKeys:
dart run easy_localization:generate --source-dir assets/languages/ -f keys -O lib/ui/theme -o codegen_key.g.dart
Important Setup Note
Added crucial pubspec.yaml configuration requirement:
flutter:
assets:
- assets/languages/
Why This Update?
This version specifically addresses the tedious manual process of setting up easy_localization:
Before v1.0.1 (Manual Process):
- β Manually find all hardcoded strings
- β Manually add each to assets/languages/en.json
- β Manually replace each in code with LocaleKeys.key.tr()
- β Manually run code generation with correct parameters
- β Manually configure pubspec.yaml
After v1.0.1 (Automated):
- β
Add
assets/languages/to pubspec.yaml - β
Run:
dart run flutter_hardcode_localizer:localize - β
Run:
dart run easy_localization:generate --source-dir assets/languages/ -f keys -O lib/ui/theme -o codegen_key.g.dart - β Add import and test!
1.0.0 - 2025-08-14 #
π Initial Stable Release #
- β Smart hardcoded string detection
- β Interactive CLI with user prompts
- β Automatic JSON key generation
- β Reliable code transformation
- β Support for arrays, methods, constructors, maps
- β Comprehensive test coverage
- β Production-ready stability