A Swift script to determine and optionally remove unused localization keys in your project.
- Determines unused localization keys by scanning Swift files in the project.
- Optionally removes unused keys from the specified language file.
- Creates a backup of the original language file before removal.
- Swift installed on your machine.
- Open Terminal.
- Copy paste the script in your project
- Navigate to your project
Replace /path/to/your/Localizable.strings
with the actual path to your Localizable.strings file.
The --remove
flag is optional and will automatically remove unused keys from the file.
swift strings-sweeper.swift --lang /path/to/your/Localizable.strings --remove
swift strings-sweeper.swift --lang ./Localizable.strings --remove
strings-sweeper.mov
--lang
: Specify the path to the language file (default is ./Localizable.strings).
--remove
: Automatically remove unused keys from the language file.