flutter_hardcode_localizer 1.0.10
flutter_hardcode_localizer: ^1.0.10 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.10 - 2025-08-28 #
🐞Fixes
- ✅ Fixed target files processing issue
- ✅ run tool command in readme.md file updated
Dependencies updated.
1.0.9 - 2025-09-17 #
🎉New Tool features added #
Additional optional run argument targetFiles added for CLI tool
dart run flutter_hardcode_localizer:localize \
--targetPath example \
--targetFiles lib/main.dart \
--skipFiles lib/widgets/skip_file_1.dart,lib/widgets/skip_file_2.dart \
--autoApproveSuggestedKeys true \
--prefix prefixText
--targetPath
(Optional) Path to your project’s target directory.
(Default) '.'
--targetFiles
(Optional) Comma-separated list of file paths to process, rest of the files will be skipped.
(Default) []
--autoApproveSuggestedKeys
(Optional, true/false) Automatically approve suggested JSON keys without developer consent.
(Default) false
--skipFiles
(Optional) Comma-separated list of file paths to skip during processing.
(Default) [lib/ui/theme/codegen_key.g.dart]
--prefix
(Optional) Add [a-z]{2,6} prefix to every json keys.
(Default) ''
1.0.8 - 2025-08-28 #
🐞Unnecessary localisation of dart statements will be ignored
- ✅ Print statements invoked with print("someText") method will be skipped now
Dependencies updated.
1.0.7 - 2025-08-21 #
🎉New Tool features added #
Additional optional run argument prefix 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 \
--prefix prefixText
--targetPath
(Optional) Path to your project’s target directory.
(Default) '.'
--autoApproveSuggestedKeys
(Optional, true/false) Automatically approve suggested JSON keys without developer consent.
(Default) false
--skipFiles
(Optional) Comma-separated list of file paths to skip during processing.
(Default) [lib/ui/theme/codegen_key.g.dart]
--prefix
(Optional) Add [a-z]{2,6} prefix to every json keys.
(Default) ''
1.0.6 - 2025-08-19 #
🐞Unnecessary localisation of dart statements will be ignored
- ✅ Switch Case & If expression will be skipped
Dependencies updated.
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!