84

I need to set Spanish as development language for an iOS app. I'm already using Xcode 6, and I changed the Localization native development region entry in app's Info.plist (CFBundleDevelopmentRegion) from "en" to "es". However, in Project > Info > Localizations, English remains set as Development Language.

As said in Information Property List Key Reference, CFBundleDevelopmentRegion specifies the default language. I need to set Spanish to the default language, what am I missing?

Thanks

AppsDev
  • 11,441
  • 20
  • 81
  • 163

5 Answers5

97

Here's how you can do this:

  1. Add the language you want to be your Base language first. Uncheck all of the files that Xcode offers to localize for you.
  2. In the Info.plist, change the development region to the language that you want to be your base language. Note that the property is a bit misnamed, because its value should be a language code (with an optional country code), rather than a region or country code.
  3. Close your project in Xcode. In another code editor, open projectname.xcodeproj/project.pbxproj and search for developmentRegion. You should see a line like developmentRegion = English;. Change this to reference the same language you put in your Info.plist file.
  4. Reopen the project in Xcode. Go through all your localizable files and check the boxes next to English to generate the localizable resources. Note that for storyboards and xibs, Xcode might create a storyboard instead of a strings file. If that happens, just change the filetype to strings file.

Here's an example of the result for me using fr as the Base language:

Project info

File info

lensovet
  • 4,683
  • 1
  • 21
  • 18
  • 3
    Did you change the line to `developmentRegion = francais`, or `developmentRegion = fr`? – Flimm Nov 03 '16 at 12:28
  • 2
    fr is what you want to use here – lensovet Nov 05 '16 at 03:45
  • 3
    Note that you might also need to add your language code to the `knownRegions` list (in the .pbxproj file) for it to show property under the project settings. – Patrick Pijnappel Dec 13 '16 at 14:54
  • 1
    You shouldn't need to do that if you add the localization first, which is step 1 of the instructions in this answer. – lensovet Dec 15 '16 at 01:53
  • 1
    In addition to what @PatrickPijnappel pointed out, I can say that just adding your language code to the `knownRegions` list is enough to make it appear on the Localizations list, without the need for your first step, that (at least on Xcode 8.3.2) cannot be done without checking at least one file and so adding a maybe unwanted localization strings file to your project. – Cristina De Rito May 04 '17 at 08:57
  • 1
    use "ar" for arabic – Abuzar Amin Oct 30 '18 at 20:33
  • 2
    Just to clarify. `developmentRegion` must be set at `fr` and not to `francais`. Reason: project.pbxproj's developmentRegion is passed to the target as `export DEVELOPMENT_LANGUAGE=fr` and this value is usually used as `CFBundleDevelopmentRegion$(DEVELOPMENT_LANGUAGE)` in the Info.plist and `CFBundleDevelopmentRegion` documentation says it should be in ISO 639-1 or ISO 639-2 format https://developer.apple.com/documentation/bundleresources/information_property_list/cfbundledevelopmentregion. So 'fr' is correct and 'francais' is not. – nacho4d Oct 28 '19 at 10:25
  • 1
    If I "uncheck all the files xcode offers to localize", the language does not get added...? – Nicolas Miari Jul 06 '20 at 00:32
  • The plist already contains the macro `$(DEVELOPMENT_LANGUAGE)`, so I guess I only need to change the xcode project file? – Nicolas Miari Jul 06 '20 at 00:36
  • Yes, that's a change that was recently added to Xcode. Older projects would not have it. – lensovet Jul 14 '20 at 00:06
  • @lensovet can we change developmentRegion by targets? I have a two targets on one I want en to be Base Region on the second target I want another language as the base. P.S. changing in Info.plist doesn't work – clopex Jul 15 '20 at 08:29
  • in my case localization for "ru" didn't work and it was fixed only after adding "ru-RU" – Kirill Karmazin Oct 15 '20 at 20:25
  • That sounds like some other configuration issue @KirillKarmazin. `ru` should absolutely work. – lensovet Oct 23 '20 at 01:32
  • @clopex good question and i'm not sure if this is supported. If you are seeing unexpected behaviors, please file feedback through Feedback Assistant. – lensovet Oct 23 '20 at 01:32
  • Nothing changed after changing the value... – Blaszard Dec 07 '20 at 10:06
58

For Xcode 9 through 11:

Close Xcode.

  1. Open your project.pbxproj in a text editor
  2. Look for developmentRegion and set its value (es for spanish, fr for french,...)
  3. Look for knownRegions and add the new language to the list

Open Xcode: Your project info should now show the language name with Development Language next to it.

ahbou
  • 3,796
  • 19
  • 33
  • 4
    To find your project's `.pbxproj` file: https://stackoverflow.com/a/3054073/4084269 – Josselin Mar 12 '19 at 09:58
  • 1
    No need to close Xcode, apparently (at least in Xcode 11) – Snowy_1803 Apr 14 '20 at 16:05
  • How I can add couple of languages as app language in App Store? For example my already published app language is showing English only, but I want to add German as app language as well – David Apr 17 '20 at 14:52
  • @David that's something you can do on App Store connect – ahbou Apr 17 '20 at 17:50
  • Thanks for your answer @ahbou. But I could not find any place to do that. Can you please direct me? – David Apr 19 '20 at 12:43
  • @David, you need to add those languages to your project. Select the project in the file navigator, select it again in the document outline, and then go to the first tab to add more localizations. – lensovet Jul 14 '20 at 00:07
37

In your project's .xcodeproj file, search for the string developmentRegion. Supposedly, it says "English" right now. If you change it to "Spanish", Xcode 6 should recognize Spanish as your project's default localization language in the "Info" tab as long as you add "Spanish" to the list.

You can read more about this topic at http://eschatologist.net/blog/?p=224

Elwisz
  • 639
  • 1
  • 6
  • 16
  • 1
    Thanks. I've just done what you explain, and I've now Spanish language set as Development Target in Info > Localoizations. However, if I change the language of the device to a language I've not defined in Localizations (let's say French, since I only have defined English and Spanish localizations), I get the app still localized in English, and not Spanish as I expected... – AppsDev Sep 19 '14 at 09:41
  • The device probably is set to prefer English to Spanish regarding a language fallback. Here's some insight about how the app's bundle is searched for localized content: https://developer.apple.com/library/ios/documentation/CoreFoundation/Conceptual/CFBundles/AccessingaBundlesContents/AccessingaBundlesContents.html#//apple_ref/doc/uid/10000123i-CH104-SW7 – Elwisz Sep 19 '14 at 13:38
  • 1
    If you want to change the default language and have your app already in the store, don't forget to change it also in iTunes Connect. – Nat Nov 06 '15 at 17:38
  • @Arefly in Language & Region settings on the device, tap the Edit button in the upper right and reorder the list of languages so that English is below Spanish in the list of languages. – lensovet Jan 03 '17 at 07:01
4

open your target -> info -> change "Localization native development region" to your language

AleyRobotics
  • 922
  • 1
  • 10
  • 16
0

For someone that needs help like I did, I have two targets, one I want to be EN Base localization and second target I need to be another language. The option mention above: "change projectname.xcodeproj/project.pbxproj and search for developmentRegion and change ..." doesn't work for me because of targets.

What worked for me, Xcode 11.5, is that only I need to change the language code in the "Localization native development region" for that particular target and it works, no need to change anything in projectname.xcodeproj/project.pbxproj P.S. Here "Localization native development region" must go country code like fr_Fr or in my case hr for Croatian

clopex
  • 360
  • 5
  • 10