Skip to content

Latest commit

 

History

History
84 lines (52 loc) · 2.88 KB

README.md

File metadata and controls

84 lines (52 loc) · 2.88 KB

NHLocalize

##What is? NHLocalize help you to localize your apps, without coding for all propreties like this:

[_mylabel setText:NSLocalizedString(@"key", @"comment")];

Using NHLocalize you can do it through Storyboard....

##How Install?

Installation with CocoaPods

I recommend you to take a look at CocoaPods and use it for dependency management in your iOS projects.

To add NHLocalize to your project it is necessary that the following lines are in your Podfile:

platform :ios, '7.0'
pod "NHLocalize", "~> 1.1.0"

Installation without CocoaPods

  1. Download NHLocalize;
  2. Drag an drop NHLocalize folder into your project;

##How to use? ###Create Localizable.strings Create the Localizable.strings, as you know. If you don't read it first: (http://www.raywenderlich.com/2876/localization-tutorial-for-ios)

###Let's get start
Now, go to your Storyboard, select you object (in my case is an UILabel) and open Identity Inspector. On Key Path add the tag nhlLabel. Type change to String. And in Value you need to add the key you've created on Localizable.strings, in this case I added LABEL.

Localize UIButton

With UIButton you can localize in all ControlStates. For UIControlStateNormal use: nhlButtonNormalTitle on Key Path.

For UIControlStateHighlighted use: nhlButtonHighlightedTitle on Key Path.

For UIControlStateDisabled use: nhlButtonDisabledTitle on Key Path.

For UIControlStateSelected use: nhlButtonSelectedTitle on Key Path.

For UIControlStateApplication use: nhlButtonApplicationTitle on Key Path.

For UIControlStateReserved use: nhlButtonReservedTitle on Key Path.

Localize UIImageView

For UIImageView you need use nhlImageView on Key Path.

Localize UILabel

For UILabel you need use nhlLabel on Key Path.

Localize UISegmentedControl

To Localize an UISegmentedControl you need follow step "Create Localizable.strings" and add a sufix on your KEY in Localizable.string and VALUE on Storyboard, like this: "-0" or "-1" or "-2" (without quotes), where the number is relative to index from your SegmentControl.

Example: MYKEY-0 or MYOTHERKEY-1

Localize UITextField

You can localize the text and the placeholder. For text use nhlTextField on Key Path. For placeholder use nhlTextFieldPlaceholder on Key Path.

Localize UITextView

For UITextView use nhlTextView on Key Path

##Note You can use it with UILabel, UIButton, UITextField, UITextView, UIImageView and UISegmentedControl. Test and working on iOS 6 and iOS 7.

Enjoy :)