To recap the problem I have a number of projects where I have added localizations for multiple languages. The preferred way to identify each language or locale you add is with the two letter ISO country code. So the Spanish locale is named “es”, the French one “fr” and the English locale should be “en”. You can add localized NIB and strings files with these locales without a problem. The frustration comes when, since you now have an “en” locale you delete the original default “English” locale. At this point you can no longer add or delete any other locales until you delete all of the locales and start from scratch.
Chris steps through the solution on how to edit the Xcode project file and rename the English locale. However in my case I found I could get the same result slightly more easily as follows.
Delete the English localizations
In my projects I have already added a new “en” locale together with the other locales that I want. So instead of doing a search and replace of the project file as Chris suggests I just delete the “English” locales from my Xcode project:
In this example I delete the “English” version of the MainWindow.xib file and the “English” strings file leaving the “en” version that I previously added. You can also delete the English.lproj directory from your source code as it will no longer be used.
Set the development region
At this point you need to quit Xcode and Interface Builder and add a line to the
project.pbxproj file that you will find in the
<project-name>.xcodeproj directory. Open the
project.pbxproj file with your favourite text editor (TextMate in my case) and look for the knownRegions setting in the PBXProject section. This should contain a list of the default Xcode locales together with the ISO two letter locales added to the project. Do NOT delete the English locale. Instead insert the following line:
developmentRegion = en;
To be clear after the change your project file should look something like this (assuming that you added the en, it, es, de and fr locales to your project.).
developmentRegion = en; knownRegions = ( English, Japanese, French, German, en, it, es, de, fr, );
Save the project file and reopen Xcode and make the final change suggested by Chris to the Info.plist for each target in your project. Change the Value for the
CFBundleDevelopmentRegion (Localization native development) key from “English” to “en”.
You should now have a single English language locale named “en” and still be able to add and delete localizations as you wish. A final tip of the hat to Chris Hanson for pointing me to the solution.