Giter Club home page Giter Club logo

objc_strings's Introduction

Goal

Helps Cocoa applications localization by detecting unused and missing keys in '.strings' files.

Input

Path of an Objective-C project.

Output

  1. warnings for untranslated strings in *.m
  2. warnings for unused keys in Localization.strings
  3. errors for keys defined twice or more in the same .strings file

Typical usage

$ python objc_strings.py -p /path/to/obj_c/project
./MyProject/en.lproj/Localizable.strings:13: warning: unused key in en.lproj: "Misc"
./MyProject/ViewController.m:16: warning: missing key in fr.lproj: "World"

Xcode integration

  1. make objc_strings.py executable

    $ chmod +x objc_strings.py

  2. copy objc_strings.py to the root of your project

  3. add a "Run Script" build phase to your target

  4. move this build phase in second position

  5. set the script path to "${SOURCE_ROOT}/objc_strings.py"

settings warnings

Common Issues

Some may experience UnicodeDecodeError when running the script. The problem is that the script runs through all directories to look for .strings files, which may include already compile .strings files which can not be parsed. Often you have some in Build/ or if you integrate CocoaPods ( Pods/ )

To prevent this you can add dirs which you want to have excluded like this

"${SRCROOT}/objc_strings.py" --exclude-dirs=['Build','Pods']

ToDo

  • Scan Interface Builder (.xib) Files for localized Strings

objc_strings's People

Contributors

albertschulz avatar modamoda avatar nst avatar swissquote-nst avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.