translations_cleaner
0.2.1, released 5 months ago by chinmaykabi.com
Command-line tool to find, delete, and sort unused translations in .arb files.
What it does
Searches Dart files using AST parsing to detect key usage and automatically cleans, sorts, or lists unused translation keys across all languages in .arb files. Designed for flutter_localizations.
AI-written summary of version 0.2.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You use flutter_localizations with .arb files and want to remove dead or unused translation keys.
- You want to sort translation keys alphabetically.
- You want to enforce unused translation checks in a CI pipeline.
Skip it when
- Your project uses localization formats other than .arb files, such as JSON or YAML.
- You need automated runtime localization loading rather than a build-time/dev-time cleanup utility.
Strengths
- AST-based detection drastically reduces false positives compared to raw regex searches.
- Supports multiple commands including cleaning, listing unused terms, and sorting translations.
- Can be easily integrated into CI workflows with the abort flag.
Weaknesses
- Limited exclusively to .arb files and flutter_localizations.
- Does not support other localization formats like JSON or YAML.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 4
Add translations_cleaner as a dev dependency in your pubspec.yaml and run via dart run or flutter pub run.
dart pub add --dev translations_cleaner
dart run translations_cleaner clean-translationsAlternatives
Packages that do the same job and could replace translations_cleaner.
- slang
Type-safe i18n solution generating Dart translation classes from JSON, YAML, CSV, or ARB files
90Compare - remove_unused_localizations
Detects and removes unused localization keys from .arb files.
52Compare - flutter_arb_translator
A command line tool to automatically translate Flutter ARB localization files using various APIs.
71Compare - remove_unused_localizations_keys
Command-line tool to identify and clean unused localization keys from ARB files.
49Compare
Works with
Packages commonly used together with translations_cleaner: ones it builds on, ones built on it, and its own family.
- analyzertranslations_cleaner depends on itPerforms static analysis of Dart code for tool integration and embedding.
- globtranslations_cleaner depends on itA file and directory globbing library that supports Bash-style path matching and listing.
- argstranslations_cleaner depends on itLibrary for parsing raw command-line arguments into options and values using GNU and POSIX styles.