VCUnusedLocalization is a command-line tool that helps you identify unused localization keys in your iOS/macOS projects. It scans your project's .strings
files and Swift source code to detect localization keys that are defined but never used, helping you maintain a cleaner codebase.
- 🔍 Scans
.strings
files for localization keys - 📱 Analyzes Swift source files for string literal usage
- 🚀 Fast and efficient with concurrent processing
- 🎯 Excludes specific paths (Pods, Carthage, etc.)
- 💻 Command-line interface with simple usage
- 📊 Detailed progress and result reporting
You can install VCUnusedLocalization using Homebrew:
brew install vuralclk/vcunusedlocalization/vcunusedlocalization
git clone https://github.com/vuralclk/VCUnusedLocalization.git
cd VCUnusedLocalization
swift build -c release
sudo cp .build/release/VCUnusedLocalization /usr/local/bin/vcunusedlocalization
Basic usage:
vcunusedlocalization scan --path /path/to/your/project
If no path is specified, it will scan the current directory:
vcunusedlocalization scan
The tool provides detailed output including:
- Total number of localization keys found
- Total number of Swift files scanned
- List of unused localization keys
- Execution time
- Any errors encountered during scanning
Example output:
Searching for Localization Keys in .strings files...
Total 150 localization keys found.
Total 45 swift files found.
Searching for unused keys...
Unused Localization Keys:
welcome.unused.key
settings.obsolete.text
profile.deprecated.title
Total 3 unused localization keys found.
Completed in: 0.5s
- macOS 10.15 or later
- Swift 5.9 or later
The project follows actor-based concurrency model with Swift's modern concurrency features:
FileScanner
: Main actor responsible for coordinating the scanning processLocalizationParser
: Handles parsing of .strings filesFileManagerActor
: Manages file system operationsConsoleLogger
: Handles output formatting and loggingProjectAnalyzer
: Coordinates the overall analysis process
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Vural Çelik
- Swift Team for SwiftSyntax
- Apple for Swift Argument Parser
- Special thanks to Arif Okuyucu for his valuable support and guidance on this project
Don't forget to ⭐️ this repo if you find it useful!