- This project is using ARC and tested in iOS 4.3, if your project is using non-ARC, in your project target -> Build Phases -> Compile Sources, add
-fobjc-arc
to Compiler Flags in JSLocalizedString.m
- Create a file named Localizable.strings in your project.
- Go to Project -> Info -> Localizations section, add a new language that you want.
- ![alt text] (https://raw.github.com/jslim89/JSLocalizedString/master/screenshots/add-localization.png "Add more language")
- Drag the JSLocalizedString (inside the Libraries folder) to your project.
- Check the option Copy items into destination group's folder (if needed)
- Choose Create groups for any added folders
- Add to project target
- Select your file you created just now Localizable.strings, localize it
- ![alt text] (https://raw.github.com/jslim89/JSLocalizedString/master/screenshots/localize-the-file.png "Localize the file")
- Under your Supporting Files, edit -Prefix.pch, add
#import "JSLocalizedString.h"
so that you can use this in whole project (import globally). - You're done.
- You can set language by calling
JSSetLanguage(@"en");
, then it will look for the en.lproj folder. self.navigationItem.title = JSLocalizedString(@"Settings", @"Localized bar title: Settings");
this is similar toNSLocalizedString
- You can look the demo project for more info.
- Inspired by Custom localization system for your iphone games