NSLocalizedString in XCODE 4.2 problem

Author: ChilliPepper, 11 Dec, 2011
Question:

Hi everybody! HELP ME please, I don't know what to do... I've been trying for 3 days to make localization for my app, there is no problem with .xib files, but with NSLocalizedString(@"All Satellites", @"All Satellites") it's doesn't work. en.lproj and ru.lproj are in root directory with Localizable.strings in it. NSLocalizedString always return KEY not VALUE. Clean and build and deleting from device and simulator has no result.... What's wrong... I've tried to make Localizable.string with genstrings and through new file->resource->string files, also converted it to UTF16 and in the right side of xcode pressed + localization for languages. I created it in Xcode 3 and then opened it in Xcode 4 and had the problems I mentioned.


Solution of this problem! It was very hard to find it :-)

XCode 4 and Localizable.strings issue
It was very annoying issue. XCode doesn't copy Localizable.strings files into app bundle. First time i used workaround: delete Localizable.strings with languages and add to project again, but when i made build for distribution i found out that Localizable.strings files are not copied in app bundle! I tried all possible and impossible combinations: remove from "Copy bundle resources" (Target\Build phases), manually add Localizable.strings into "Copy bundle resources", different "Localization native development region" strings, different place in project hierarchy, different encodings (should be UTF-16), XCode 4.2 beta, XCode 4.0 and other. It was unsuccessful. I have: correct Localizable.strings, correct instruction to copy files in "Copy bundle resources", no warnings in project. I don't have: Localizable.strings files in app bundle.



After 2 days i found solution! It was very simple:
1. goto Target\Build phases
2. click "Add build phase" button and select "Copy files"
3. select "Resources" in "Copy files" phase
4. add Localizable.strings
5. make build for distribution (Project\Archive).
5. check app folder for all Localizable.strings files - PROFIT!


Comments (0)

You need to Login to post a comment!
Total users: 17
Last registers:

EdikEdik

GreenMaxGreenMax

invifiepledinvifiepled

artem001artem001

IRINAIRINA

Archive:

December 2011

November 2011

January 2011

December 2010

November 2010

October 2010

August 2010

June 2010

May 2010


© 2012, Chilli Talks - Contacts