macOS Sierra Regression in [NSLocale preferredLanguages]
| Originator: | therzok | ||
| Number: | rdar://28161679 | Date Originated: | 2016/09/05 |
| Status: | Closed | Resolved: | No |
| Product: | OS X SDK | Product Version: | |
| Classification: | Reproducible: | Always |
Summary:
Given a setup like in the screenshot, I have observed different behaviours of [NSLocale preferredLanguages] by comparing the selector in both El Capitan and Sierra.
Adding this logging code
NSLog(@"Current %@", [[NSLocale currentLocale] localeIdentifier]);
NSLog(@"Preferred %@", [[NSLocale preferredLanguages] objectAtIndex:0]);
I have observed the following:
El Capitan:
Current en_RO
Preferred en
Sierra:
Current en_RO
Preferred en_RO
This behaviour change is not stated in the release notes, therefore I counted it as a serious bug/regression in the Beta 8 version (it's been there in Beta 7 too).
Steps to Reproduce:
1. Have both an El Capitan and a Sierra machine.
2. Install Xcode
3. Set the Locale preferences as in the screenshot attached.
4. Create a commandline tool project
5. Replace the contents of the main file with the attached file or add the two logging snippets in the description
6. Run the program, see the results in the description.
Expected Results:
The expected identifier of the first preferred language should be the same as in El Capitan, containing no regional information - i.e. with the attached configuration: en
Actual Results:
The identifier of the preferred language contains regional data, which are in no way related to the actual language that has been set - i.e. with the attached configuration: en-RO
Version:
Xcode8-beta6 + macOS Sierra 10.12 Beta (16A313a) - broken
Xcode8-beta6 + OS X El Capitan 10.11.6 (15G1004) - works
Notes:
Configuration:
Any OS X 10.12 capable device
Attachments:
'main.m' and 'Screen Shot 2016-09-05 at 18.12.50.png' were successfully uploaded.
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!
Response
Engineering has determined that this issue behaves as intended based on the following information:
This is expected behavior in macOS Sierra. Please refer to the following technical note published on this topic: https://developer.apple.com/library/content/technotes/tn2418/_index.html