flutter_hardcode_localizer 1.0.1 copy "flutter_hardcode_localizer: ^1.0.1" to clipboard
flutter_hardcode_localizer: ^1.0.1 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.1 - 2025-08-14 #

🚀 Enhanced for easy_localization Integration #

New Features

  • LocaleKeys.key.tr() Format: Changed replacement format from Locale.$key to LocaleKeys.$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.json instead of lang/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):

  1. ❌ Manually find all hardcoded strings
  2. ❌ Manually add each to assets/languages/en.json
  3. ❌ Manually replace each in code with LocaleKeys.key.tr()
  4. ❌ Manually run code generation with correct parameters
  5. ❌ Manually configure pubspec.yaml

After v1.0.1 (Automated):

  1. ✅ Add assets/languages/ to pubspec.yaml
  2. ✅ Run: dart run flutter_hardcode_localizer:localize
  3. ✅ Run: dart run easy_localization:generate --source-dir assets/languages/ -f keys -O lib/ui/theme -o codegen_key.g.dart
  4. ✅ 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
4
likes
0
points
31
downloads

Publisher

unverified uploader

Weekly Downloads

A Dart plugin that finds hardcoded strings in Flutter projects and provides quick-fix to move them to localization files for easy_localization.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

analyzer, custom_lint_builder, dart_style, path

More

Packages that depend on flutter_hardcode_localizer