76

If I change the language on an iOS 8.1 simulator to anything and try to detect this from code with

NSString * language = [[NSLocale preferredLanguages] objectAtIndex:0];
NSLog(@"Language: %@", language);

I get "en" back. I've tried resetting the navigator, etc. I've tried this using the iOS 7.1 runtime (in Xcode 5.1.1), and it worked fine. Has anyone managed to find a workaround to this problem?

Jeremy Huddleston Sequoia
  • 22,938
  • 5
  • 78
  • 86
Janos
  • 1,987
  • 3
  • 17
  • 24
  • You should file a bug about it. – dasdom Jul 05 '14 at 16:14
  • Check the "known bugs" section of the release notes. – Kevin Jul 05 '14 at 16:24
  • iOS 8 Beta 3 fixes this issue. – Janos Jul 11 '14 at 23:10
  • 1
    Currently have this simulator bug using Xcode Version 6.1 (6A1052d) and running OSX Ver 10.9.5. Correct code above returns en on simulator with language set to Chinese (simplified) while actual iPad returns "zh-Hans" as expected. Will try upgrade to OS-X X. – harry Oct 22 '14 at 21:00
  • @hangzhouharry Many thanks. I also confirmed the result. The bug seems to occur only in the iOS8 Simulator. It is working fine in iOS7 simulators and iDevices, though. – Nimit Pattanasri Oct 23 '14 at 13:23
  • 1
    After upgrading my dev machine to Yosemite, continue to have 7.1 simulator work correctly, 8.1 continues to fail. – harry Oct 24 '14 at 08:21
  • 1
    This is definitely failing still for me in an 8.1 simulator. – Estel Oct 24 '14 at 09:02
  • possible duplicate of [iOS8.1 Simulator always uses US keyboard layout despite german hardware keyboard](http://stackoverflow.com/questions/26146668/ios8-1-simulator-always-uses-us-keyboard-layout-despite-german-hardware-keyboard) – Jeremy Huddleston Sequoia Oct 29 '14 at 01:56
  • Works with new xCode Version 6.2! – Fabio Berger Mar 10 '15 at 14:43

5 Answers5

170

According to the release notes this is a known issue. There is a work around. If you go to "Edit Scheme..." then the "Options" tab there's an "Application Language" option. This only affects the current run settings, not the app, much like changing the language of the device.

enter image description here

adjwilli
  • 9,658
  • 4
  • 35
  • 29
  • 3
    Works for apps, but apparently not for extensions. – Koraktor Nov 08 '14 at 10:28
  • 3
    This must be accepted as an answer. While it doesn't offer a fix for iOS simulator bug, that's what Apple has to do, this answer offers the best workaround to run your apps localized. IMHO, this approach is much better if you only need to run your app localized and don't care about changing system language in simulator. – i4niac Nov 09 '14 at 02:11
  • This is quicker than changing language settings in the Simulator - nice! – Custom Bonbons Jan 15 '15 at 14:33
  • 2
    This work only partially for me. Storyboard localization works, but not localized strings =\ – CTiPKA Feb 17 '15 at 12:36
  • Instead of setting a concrete language, use "System Language". This is another option here. This will make the simulator language valid. – snoersnoer Mar 28 '17 at 10:02
1

Another dupe of iOS8.1 Simulator always uses US keyboard layout despite german hardware keyboard

Known and documented bug as mentioned in the Xcode 6.1 release notes. File a radar if you want to add your +1 to the complaint list at http://bugreport.apple.com

Community
  • 1
  • 1
Jeremy Huddleston Sequoia
  • 22,938
  • 5
  • 78
  • 86
1

My simulator is in French language. When I want to check interface in English then changing the iphone language is not enough. I have to switch the region settings minimum two times.

Blazej SLEBODA
  • 8,936
  • 7
  • 53
  • 93
0

use [[NSLocale availableLocaleIdentifiers]

MillaresRoo
  • 3,808
  • 1
  • 31
  • 37
Diego
  • 2,395
  • 2
  • 21
  • 27
0

In my case, editing schema works for region but not for language. It looks overwrite by development language. Changing developmentRegion works fine with project.pbxproj like this.

developmentRegion = ja;

enter image description here

Xcode Version 11.3.1 (11C504)

iPhoneX iOS 13.3.1

kazuwombat
  • 1,515
  • 1
  • 16
  • 19