Skip to content

Swift script for verifying Localized Strings in a project

License

Notifications You must be signed in to change notification settings

mikaelbo/CheckLocalizedStrings

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CheckLocalizedStrings

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.

screen shot 2018-04-30 at 12 34 23

Features

  • Check for unused keys
  • Check for missing keys
  • Check for mismatched parameters
  • Check for duplicate definitions of a key

Installation

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

Arguments

The script takes 5 arguments. The first one, already included in the above snippet, is required. The rest are optional.

  1. Project directory
  2. Localized string function names (comma separated). Default: NSLocalizedString
  3. Storyboard/XIB localized function variables (comma separated). (See LocalizableViews in SampleApp for usage)
  4. Ignore files
  5. 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

License

CheckLocalizedStrings is available under the MIT license. See the LICENSE file for more info.