translations_cleaner
Dart package to search and delete unused translations from .arb files, for all languages, all in one go.
NOTE : This package has been developed keeping
flutter_localizationspackage in mind, which uses.arbfiles for all translations.
Usage
# Add translations_cleaner as a dev dependency
dart pub add --dev translations_cleaner
# Run the command to clean all the translations
flutter pub run translations_cleaner
Why ?
Translations can be a very time taking process when the app starts to scale and there are a lot many translations. Hence it is a good practice to clean the translations if it is not being used. Checking for unused translations is tedious, hence this package.
How ?
translations_cleanerlooks for all the.arbfiles located in the directory, and fetches all the translations, from all the languages.- Then it looks for all the
.dartfiles. - All the translation terms are looked for in these dart files
- The translations not found in the dart files are removed from the corresponding
.arbfiles, including any attributes as well
Limitations ?
- This package currently works only for l10n achieved via
flutter_localizations, which uses.arbfiles. - There are other l10n packages which use
.jsonand.yamlfor saving translations. These are not supported currently
