mikaelbo / CheckLocalizedStrings

Swift script for verifying Localized Strings in a project

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

About

Swift script for verifying Localized Strings in a project

License:MIT License


Languages

Language:Swift 100.0%