easy_localization_cleaner 0.0.5
easy_localization_cleaner: ^0.0.5 copied to clipboard
A Dart CLI tool designed to clean up unused localization keys from JSON/Arb files used with the easy_localization package.
easy_localization_cleaner #
easy_localization_cleaner
is a Dart CLI tool designed to clean up unused localization keys from JSON files used with the easy_localization
package. It helps developers maintain clean and organized localization files by identifying and removing unused keys.
Features #
- Extract Localization Keys: Scans your Dart files for localization keys.
- Identify Unused Keys: Compares the keys in your JSON files with the ones used in your code.
- Remove Unused Keys: Safely removes unused keys from your JSON files while preserving base keys.
- Export Logs: Generates a log file listing unused keys for review.
- Format JSON Files: Allows you to specify the indentation format for JSON files (e.g., tabs or spaces).
Installation 💻 #
Install via dev dependency #
$ flutter pub add --dev easy_localization_cleaner
# And it's ready to go:
$ dart run easy_localization_cleaner:main [options]
or Globally activate the package: #
$ dart pub global activate easy_localization_cleaner
# And it's ready to go:
$ easy_localization_cleaner [options]
Usage 🚀 #
To use easy_localization_cleaner
, run the following command:
$ easy_localization_cleaner --current-path=/path/to/project --assets-dir=assets/translations
Options #
Option | Description | Default Value |
---|---|---|
--current-path , -p |
The current path of the project. | Current directory (. ) |
--generated-class-key , -g |
The name of the generated class key. | LocaleKeys |
--assets-dir , -a |
The directory where the JSON files are located. | assets/translations |
--[no-]export , -e |
Save unused keys as a .log file in the path provided. | false |
--json-indent , -j |
Specify the JSON indentation format. Use \t for tabs or a number (e.g., 4 ) for spaces. |
(2 spaces) |
--help , -h |
Display the help message. |
Examples #
-
Default Usage:
$ easy_localization_cleaner
-
Specify JSON Indentation with Tabs:
$ easy_localization_cleaner --json-indent=\t
-
Specify JSON Indentation with 4 Spaces:
$ easy_localization_cleaner --json-indent=4
-
Run with All Options:
$ easy_localization_cleaner --current-path=/path/to/project --assets-dir=assets/translations --json-indent=4 --export
Contributing 🤝 #
Contributions are welcome! Please open an issue or submit a pull request.
License 📄 #
This project is licensed under the MIT License - see the LICENSE file for details.