• Stars
    star
    156
  • Rank 239,589 (Top 5 %)
  • Language
    Python
  • License
    BSD 3-Clause "New...
  • Created over 8 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A tool for finding missing and unused NSLocalizedStrings

nslocalizer

Code Climate Test Coverage CircleCI branch Dependency Status

This is a command line tool that is used for discovering missing and unused localization strings in Xcode projects.

Contributing and Code of Conduct License

This project and related material has a Code of Conduct that is listed in the contributing.md file. This must be read and adhered to when interacting with this project. Additionally this code is released under a 3-clause BSD license that you can read here.

Requirements Python

This tool is built and tested against Python 3.5.0.

Module Version
pbPlist >=1.0
pyobjc-core >= 2.5.1
pyobjc-framework-Cocoa >= 2.5.1
langcodes >= 1.2.0

Installation

Via pip and python 3

$ pip3 install nslocalizer

To install the tool from the repo, clone from Github then run the make build command.

Usage

To use nslocalizer to generate warnings about missing or unused NSLocalizedStrings, you will have to pass it a project and target as input:

$ nslocalizer --project <path to xcodeproj file> --target <names of targets to analyze>

There are a number of flags that can be passed to modify the behavior of pyconfig:

Flags Usage
--version Displays the version of nslocalizer and exits
--find-missing Finds any strings that are missing translations for any of the supported languages
--find-unused Finds any strings that are unused in the code
--quiet Silences all logging output
--verbose Logs additional information
--ignore <languages> Will silence warnings for any of the languages listed to be ignored

Note: Both --find-missing and --find-unused flags can be supplied to the same invocation of nslocalizer.

Example

Find missing translation strings:

$ nslocalizer --project Foo.xcodeproj --target MyNewApp --find-missing
/Users/Samantha/Projects/Foo/Foo/Assets/Base.lproj/Localizable.strings:327: warning: String "foo_setup_twitter_integation" missing for: German, Traditional Chinese, European Portuguese, Spanish
/Users/Samantha/Projects/Foo/Foo/Assets/Base.lproj/Localizable.strings:356: warning: String "foo_setup_facebook_integation" missing for: German, Traditional Chinese, European Portuguese, Swedish, Polish, Latin American Spanish, British English, Brazilian Portuguese

Find unused translation strings:

$ nslocalizer --project Foo.xcodeproj --target MyNewApp --find-unused
/Users/Samantha/Projects/Foo/Foo/Assets/Base.lproj/Localizable.strings:327: warning: String "foo_setup_twitter_integation" is not used
/Users/Samantha/Projects/Foo/Foo/Assets/Base.lproj/Localizable.strings:356: warning: String "foo_setup_facebook_integation" is not used

Integration

nslocalizer is intended to be used as part of a build of the Xcode project file. To integrate you will have to add a new "run script" phase to your target and then invoke as such:

nslocalizer --project $PROJECT_DIR/YourProject.xcodeproj --target $TARGET_NAME --find-missing --find-unused

More Repositories

1

SDMMobileDevice

MobileDevice Implementation
C
567
star
2

OSXPrivateSDK

SDK target for opensource.apple.com code
C
148
star
3

Xcode-Build-Settings-Reference

Reference document for Xcode Build Settings
132
star
4

xcparse

Python library for parsing Xcode files
Python
57
star
5

machodiff

mach-o diffing tool
C
53
star
6

pyconfig

A tool for generating xcconfig files from a simple DSL
Python
48
star
7

AOS-Downloader

Apple Open Source Downloader
Python
48
star
8

apple-corecrypto

mirror of apple's corecrypto implementation
POV-Ray SDL
32
star
9

iOS-Internals

iOS related code
Objective-C
29
star
10

Onlive-Source-Backup

Backup of Onlive Source Code
C
20
star
11

pbPlist

Property List Parser and Serializer. Supports XML, Binary, and NeXTSTEP Property Lists.
Python
18
star
12

rune

tool to query for tokens and passwords for use as environment variables
Nim
14
star
13

x86-Enigma

World War 2 German Enigma Encryption Machine in x86 assembly.
Assembly
14
star
14

micro-fzf-plugin

micro plugin to open files via fzf
Lua
13
star
15

jb

replicating p0sixspwn
C
12
star
16

Core-Lib

Core C library I use for everything
C
12
star
17

BlockObservers

KVO Implementation with blocks
Objective-C
11
star
18

debugDescription

debugDescription
Objective-C
11
star
19

lldbscript

lldbscript
Python
11
star
20

usbTerm

i don't odd
Objective-C
10
star
21

loader

symbol patching v2
C
10
star
22

SM1PasswordSync

SM1Password USB Sync Tool
C
10
star
23

CFObjectRef

macros for creating custom CFTypeRefs
C++
9
star
24

pyXcode

An implementation of the Xcode build system in python
Python
8
star
25

SignatureParse

parsing mach-o binary code signatures
Objective-C
8
star
26

pbProj

Python library for parsing Xcode project files
Python
7
star
27

dotfiles

config files
Shell
7
star
28

SDMSymbolTable

Mach-O symbol table lookup code.
C
7
star
29

Mai

xcodebuild wrapper
Python
7
star
30

cs-tools

Command Line Tool for interacting with GateKeeper and codesigning
Objective-C
7
star
31

hotkeyd

a tiny hotkey daemon that runs applescripts
Objective-C
6
star
32

homebrew-formulae

https://github.com/samdmarshall/homebrew-formulae
Ruby
6
star
33

mlvwm

Macintosh Like Virtual Window Manager
C
5
star
34

xcrunner

dynamic sdk tool lookup
Objective-C
5
star
35

xcexport

Tool for parsing environment variables defined by Xcode and resolving them into compiler and linker flags for external build systems
Python
5
star
36

iTunes-Stats

Objective-C
5
star
37

pewpewthespells-com

website platform for pewpewthespells.com
Nim
5
star
38

SDK-Builder

Script for building Xcode SDKs
Python
5
star
39

space

workspace manager
Python
5
star
40

ArduinoForXcode

Arduino platform for Xcode
Python
5
star
41

necromancy

quick and simple interactive file system navigator
Nim
5
star
42

plist-processor

Simple tool to automatically expand environment variables in a plist files
Python
5
star
43

html2pdf

convert local html files to pdfs via webkit
Objective-C
5
star
44

influx.nim

HTML
4
star
45

SDMHaloMapLoader

Basic Halo Retail Map Parser
C
4
star
46

pyxcrunhelper

Python
4
star
47

OniLevelTool

Oni Level Tool
C
4
star
48

managing-xcode-example

example workspace to explore
Objective-C
4
star
49

DeviceToDeviceManager-RE

Reverse Engineering of DeviceToDeviceManager.framework
Objective-C
4
star
50

xap

C
4
star
51

cmd.nim

a replica of python's cmd.py, but in nim
Nim
3
star
52

tunes

CLI iTunes controller
Objective-C
3
star
53

TagScanner

Battle.net Tag Scanner for Diablo III on OS X
Objective-C
3
star
54

xcode-build-log-analyzer

tool to parse and reconstruct environments from Xcode build logs
Python
3
star
55

plugin-manager

HTML
3
star
56

SMDisplayServices

SMDisplayServices was created to act in place of Apple's private framework "DisplayServices".
Objective-C
3
star
57

LeapMotionDriver

Open source driver for the Leap Motion Controller
C++
3
star
58

battery-level

access to the current battery % on OS X machines
Nim
3
star
59

cmus-airpods

cmus-remote interface agent that responds to AirPods
Nim
3
star
60

pyxcscheme

Python
3
star
61

sup3rv1s0r

iOS Software Expoit to Invisibly Installing a Supervisor Provisioning Profile (long since patched)
C
3
star
62

libclang-nim

C
3
star
63

QandA

General Q&A for blog posts on pewpewthespells.com
2
star
64

homebrew-apple-open-source

homebrew formulae for apple's open source packages
Ruby
2
star
65

danger

Global Dangerfile
2
star
66

xapian.nim

C++
2
star
67

mailfeeder

A script to integrate emails based on notmuch tags into an RSS feed for casual consumption
Python
2
star
68

pyxcwsdata

Python
2
star
69

FitBitDeviceScanner

Recreating the protocol used to communicate with fitbit devices over bluetooth
Objective-C
2
star
70

pyXCConfig

Python
2
star
71

citrus

A fork of SQLIte's Lemon parser generator
2
star
72

xcodeproj

Python implementation of an Xcode Project parser
Python
2
star
73

toast-generator

windows 10 toast xml config generator
1
star
74

omni-cli

omnifocus task creator using omni sync server maildrop
Nim
1
star
75

plist

nim-lang package for serializing/deserializing property lists in all three primary formats
Nim
1
star
76

SimpleServer

Objective-C
1
star
77

binding

a simple tagging system for notmuch mail
Nim
1
star
78

micro-scratch-plugin

Lua
1
star
79

SDKBuild

Python
1
star
80

MoPaQ

mpq
C
1
star
81

Clones

Textual plugin for detecting clones on a channel
Objective-C
1
star
82

reading-list

Nim
1
star
83

where

Nim
1
star
84

pypresenter

CLI presentation tool written in Python
Python
1
star