remove_unused_localizations_keys 0.0.40 copy "remove_unused_localizations_keys: ^0.0.40" to clipboard
remove_unused_localizations_keys: ^0.0.40 copied to clipboard

A Flutter package to clean unused localization keys from .arb files. and supporting for easy_localization package

🗑️ Remove Unused Localization Keys #

ko-fi

PRs Welcome Pub Version

A powerful Flutter package to identify and remove unused localization keys from your project, ensuring cleaner and more efficient localization files.


🚀 Features #

✅ Scans your localization files and detects unused keys. ✅ Provides an interactive option to remove them automatically. ✅ Supports multiple language files. ✅ Keeps your project lightweight and optimized. ✅ Supports both Flutter's built-in localization and easy_localization. ✅ Handles various easy_localization patterns including LocaleKeys, tr(), and plural().


📦 Installation #

Add the package to dev_dependencies in pubspec.yaml:

dev_dependencies:
  remove_unused_localizations_keys: latest

Then, fetch dependencies:

flutter pub get

🔧 Usage #

For Flutter's Built-in Localization #

Run the following command to analyze your project:

dart run remove_unused_localizations_keys

For Easy Localization #

Run with the --easy-loc flag:

dart run remove_unused_localizations_keys --easy-loc

You can also specify a custom path for your translation files:

dart run remove_unused_localizations_keys --easy-loc path=assets/i18n

🛠 Advanced Options #

Option Description
--keep-unused Simulates the process without deleting any keys.
--easy-loc Enables easy_localization mode.
path= Specifies custom path for translation files (works with --easy-loc).
-- Runs without requiring user confirmation.

Examples:

# Keep unused keys in easy_localization mode
dart run remove_unused_localizations_keys --easy-loc --keep-unused

# Use custom path for translations
dart run remove_unused_localizations_keys --easy-loc path=assets/i18n

💡 Example Output #

🔍 Scanning localization files...
✅ Unused keys found:
  - home.welcome_message
  - settings.dark_mode

❓ Do you want to remove these keys? (y/N)

📊 Accuracy Testing Methodology #

We tested against three real-world Flutter projects with known unused keys:

🔍 Test Projects #

Project Total Keys Known Unused Language Files
🛒 E-commerce 1,242 87 4 (en, ar, fr, de)
📱 Social App 3,587 214 6 (en, es, pt, ru, ja, zh)
🏢 Enterprise 8,921 532 12 (multi-region)

🎯 Roadmap #

🚀 Upcoming Features:

  • ❌ Seamless CI/CD integration
  • ❌ Auto-fix feature to replace similar keys
  • ❌ Support for more localization packages

🤝 Contributing #

We welcome all contributions! Feel free to submit issues, feature requests, or pull requests. 🙌


📬 Contact #

📩 Need help? Reach out at [AbdelrahmanTolba@protonmail.com] or open an issue on GitHub.


📜 License #

📄 This project is licensed under the MIT License.

13
likes
160
points
743
downloads
screenshot

Publisher

verified publisherabdelrhmantolba.online

Weekly Downloads

A Flutter package to clean unused localization keys from .arb files. and supporting for easy_localization package

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

yaml

More

Packages that depend on remove_unused_localizations_keys