CheckLocalizedStrings is a Swift script that verifies your Localizable.strings
files in your project, and emits either a warning or error if something is wrong.
- Check for unused keys
- Check for missing keys
- Check for mismatched parameters
- Check for duplicate definitions of a key
Under your Target's Build phase, add a Run Script
. Use the path where you copied the script file to. Make sure to include $PROJECT_DIR
as an argument.
"${SOURCE_ROOT}"/{PATH_TO_SCRIPT} $PROJECT_DIR
The script takes 5 arguments. The first one, already included in the above snippet, is required. The rest are optional.
- Project directory
- Localized string function names (comma separated). Default: NSLocalizedString
- Storyboard/XIB localized function variables (comma separated). (See LocalizableViews in SampleApp for usage)
- Ignore files
- Print all warnings individually (will group similar ones in one message). Default: false
If you need to skip argument 3 or 4, you can pass an empty string:
"${SOURCE_ROOT}"/{PATH_TO_SCRIPT} $PROJECT_DIR NSLocalizedString "" "" true
CheckLocalizedStrings is available under the MIT license. See the LICENSE file for more info.