Doc of Bundle.preferredLocalizations(from:) and Bundle.preferredLocalizations(from:forPreferences:) are very confusing
Originator: | an00na | ||
Number: | rdar://31250590 | Date Originated: | 24-Mar-2017 04:48 PM |
Status: | Open | Resolved: | |
Product: | Documentation | Product Version: | |
Classification: | Serious Bug | Reproducible: |
The 2 preferredLocalizations methods are class methods but keep talking about some unspecified specific bundle as if they are called on some individual Bundle instance, which is very confusing or even plainly wrong. * preferredLocalizations(from:), https://developer.apple.com/reference/foundation/bundle/1417249-preferredlocalizations: ``` An array of NSString objects, each of which specifies the language ID for a localization that *the bundle* supports. ``` What exactly is `the bundle? * preferredLocalizations(from:forPreferences:), https://developer.apple.com/reference/foundation/bundle/1409418-preferredlocalizations: ``` Returns the localizations that a bundle object would prefer, given *the specified bundle* and user’s language preferences. ``` ``` An array of NSString objects, each of which identifies a localization in *the receiver’s bundle*. These strings are ordered in the array according to the specified preferences and are taken from the strings in the localizationsArray parameter. If none of the user-preferred localizations are available in the bundle, this method returns one of the bundle localizations. ``` What exactly are the specified bundle and the receiver’s bundle? I believe these 2 class methods should have nothing to do with any specific bundle and generate their results only with the given parameters `from` and `orPreferences`(it is implicitly Locale.preferredLanguages for preferredLocalizations(from:)). In contrast, their CF equivalents CFBundleCopyPreferredLocalizationsFromArray & CFBundleCopyLocalizationsForPreferences have much better documentations: https://developer.apple.com/reference/corefoundation/1537164-cfbundlecopypreferredlocalizatio https://developer.apple.com/reference/corefoundation/1537153-cfbundlecopylocalizationsforpref
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!