Git Product home page Git Product logo

c3po's Introduction

#Hassle Free Localization

After all these try-and-error, here're my new requirements:

  1. Fully automatic and reflect to current code. ( because we, developers, are lazy )
  2. Only ONE set of XIB/NIB is used.
  3. Ease of localization. ( one master localization strings file )

The flow becomes

  1. genstrings to make master Localization.strings
  2. ibtool to extract localizable values
  3. merge 1 and 2 with up-to-date localization

C3PO is dedicated to automate this flow. All you need to do is meeting following requirements

##Create a new build phase

find ${SRCROOT} -name "Localizable.strings" -print | xargs -I {} echo "iconv -f UTF-8 -t UTF-16 =(cat {})> {}"  | zsh
python ${SRCROOT}/externals/C3PO/localize.py
find ${SRCROOT} -name "Localizable.strings" -print | xargs -I {} echo "iconv -f UTF-16 -t UTF-8 =(cat {})> {}"  | zsh

##Use NSLocalizedString for all UI strings

myLabel.text = NSLocalizedString(@"MY_TEXT", nil);

##Use WIDE_CASE or CamelCase in Interface Builder

<string key="IBUIText">MY_TEXT</string>

or

<string key="IBUIText">MyTest</string>

##Add following lines to your controller

- (void) viewDidLoad {
	for (UILabel *aLabel in self.interfaceLabels) {
	aLabel.text = NSLocalizedString(aLabel.text, @"C3PO Localized");
}

##Your localization string is ready to go

% find . -name "Localizable.strings"
./en.lproj/Localizable.strings
./zh-Hant.lproj/Localizable.strings

Time to take your app to the world. @jamex

c3po's People

Contributors

jamessa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

iridia

c3po's Issues

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.