다중 언어 번역에서 ARB(App Resource Bundle) 파일의 사용되지 않는 번역 키를 정리하도록 설계된 Flutter/Dart 패키지입니다. 코드베이스에서 더 이상 참조되지 않는 키를 식별하고 제거함으로써 깔끔하고 효율적인 로컬라이제이션 워크플로우를 유지하는 데 도움을 줍니다. 대규모 국제화 앱을 관리하는 팀에게 이상적이며, 불필요한 항목을 줄이고 오래된 번역이 남아 있는 것을 방지합니다. 이 도구는 macOS, Windows, Linux와 호환되는 명령줄 유틸리티로 작동합니다.
사용 사례
노후화된 번역 키 제거
깨끗한 ARB 파일 유지
로컬라이제이션 워크플로우 간소화
번역 부풀어 오름 방지
CI/CD 파이프라인에서 정리 자동화
주요 기능
모든 ARB 파일에서 사용되지 않는 키를 검색합니다
다국어 ARB 파일을 지원합니다
명령줄 인터페이스
크로스 플랫폼 호환성
Flutter 프로젝트와 통합됩니다
적합한 대상
번역을 관리하는 플러터 개발자
로컬라이제이션 팀
CI/CD 파이프라인
자주 UI가 변경되는 프로젝트
국제화를 위해 ARB를 사용하는 팀
고려 사항
삭제 전 수동 검토 필요
동적 키를 처리하지 않습니다
GUI 인터페이스 없음
개발 또는 스테이징에서 가장 잘 사용됨
실행하기 전에 ARB 파일을 백업하세요
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
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_localizations package in mind, which uses .arb files for all translations.
Usage
# Add translations_cleaner as a dev dependency
dart pub add --dev translations_cleaner
dart run translations_cleaner <command> [arguments]
# OR
flutter pub run translations_cleaner <command> [arguments]
Commands Available
clean-translations - Search all the translations listed in arb files and delete the unused translations
list-unused-terms - Search all the translations listed in arb files and print/save a list of unused translations.
sort-translations - Sorts all the translations in arb files alphabetically.
Options Available
Available only for list-unused-terms
-a, --[no-]abort-on-unused - Abort execution if unused translations are found. This can be helpful in CI, if you don't want to proceed if a build should fail.
Available for clean-translations and list-unused-terms
-h, --help - Print this usage information.
-o, --output-path - Path for saving exported file, defaults to root path of the folder
-e, --[no-]export - Save unused keys as a .txt file in the path provided
-s, --include-subpackages - Include arb files from subpackages (directories with their own pubspec.yaml). By default, subpackages are excluded to avoid false positives in monorepo setups.
Why 🤔
Translations can be a very time consuming process when the app starts to scale and there are lots of translations.
It is a good practice to clean out translations that are not being used.
Checking for unused translations is tedious, hence this package.
How 🤖
translations_cleaner looks for all the .arb files located in the directory, and fetches all the translations, from all the languages.
Then it looks for all the .dart files.
It parses Dart files with AST and detects key usage from localization-style member access and matching top-level functions.
The translations not found in the dart files are removed from the corresponding .arb files, including any attributes as well
Detection: regex → AST
Unused keys used to be detected by scanning Dart files as raw text with word-boundary regex. That often marked keys as "used" when they only appeared in comments, string literals, or generated code (e.g. AppLocalizations getters). Detection is now AST-based: we parse each Dart file and only count a key as used when it appears as a member on a localization-like target (e.g. context.l10n.someKey, AppLocalizations.of(context).someKey) or as a top-level function call with the same name. That reduces false positives and aligns results with actual usage.
Performance
Regex (old): Single pass over file contents with precompiled patterns; very fast but prone to false positives.
AST (current): Each Dart file is parsed once; more work per file but only lib/**/*.dart is scanned. On large projects you may notice a few extra seconds; list-unused-terms prints timing so you can compare.
Limitations 😔
This package currently works only for l10n achieved via flutter_localizations, which uses .arb files.
There are other l10n packages which use .json and .yaml for saving translations. These are not supported currently