[TIMOB-17885] iOS 8.1: Titanium.Locale.currentLanguage only returns "en" as language
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Not Our Bug |
Resolution Date | 2014-10-29T07:52:12.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | iOS |
Labels | TCSupportTriage |
Reporter | aee Q |
Assignee | Eric Merriman |
Created | 2014-10-20T05:54:26.000+0000 |
Updated | 2017-03-23T21:19:20.000+0000 |
Description
In IOS 8.1 simulator (not on device), Titanium.Locale.currentLanguage can only return "en", no matter what the system language is set to.
This is the code that sets the default locale: https://github.com/appcelerator/titanium_mobile/blob/master/iphone/Classes/TiLocale.m#L31
You might review TIDOC-1162 for an alternate approach.
Ti.Locale.currentLanguage returns same result. But it is ok on ios8.1 device.
Tested with Ti.Locale.currentLanguage on Xocde 6, iPhone 6 simulator. It works well.
Yes,Xocde 6 is ok, only on xcode6.1,ios8.1 simulator
[~aee] Please provide a code sample, and you say it _only_ fails on iOS 8.1 simulator, not on 8.1 device? [~sliang] can you please test on Xcode 6.1 with iOS 8.1?
Tested with Xcode 6.1, problem can be reproduced.
Reproduced Step:
1.Update Xcode to 6.1. 2.Run the following simple app on iOS 8.1 simulator. 3.Got "en" language result. 4.Change language setting to Chinese.Actual Result:
Still got "en" language result.Expect Result:
should be "zh-cn". Also tried French, same problem.I just drafted up a project in Xcode 6.1 using both the [official](https://developer.apple.com/library/Mac/qa/qa1391/_index.html) and [Titanium](https://github.com/appcelerator/titanium_mobile/blob/master/iphone/Classes/TiLocale.m#L31-L41)'s code:
and ran this on my iPhone 6 running 8.1 that has Dutch (nl) as the default language and correctly got:
Running the same code in iOS 8.1 Simulator gives:
Running the same code in iOS 7.1 Simulator (build from Xcode 6.1) gives:
Thanks [~fokke] for the testing and results. After reviewing Xcode 6.1 release notes, simulator has some changes that might have caused this. https://developer.apple.com/library/ios/releasenotes/DeveloperTools/RN-Xcode/Chapters/xc6_release_notes.html Particularly the following: *Settings changed in the Settings app on iOS Simulator may not persist. (18238018)* *In some situations, [NSLocale currentLocale] may return en_US instead of the chosen locale in the iOS 8.1 simulator. (18512161)* Which is why Titanium.Locale.currentLanguage works in device and NOT simulator.
Closing ticket with reference to the above comments.