Definition of [NSLocale preferredLanguages]
according to the documentations:
The user's language preference order as an array of NSString objects, each of which is a canonicalized IETF BCP 47 language identifier.
Definition of [[NSBundle mainBundle] preferredLocalizations]
:
An array of NSString objects, each of which identifies the a localization in the receiver’s bundle. The languages are in the preferred order.
I really don't get what the difference is. Which one should be one using?
I believe language is just language, but locale implies a great deal more (e.g. calendar/date computations, currency, number formatting, etc). The Locales Programming Guide is a short read, a great place to start.
More specifically, +preferredLocalizations
, being a bundle resource, is a component of an app itself, configurable during app design, whereas +preferredLanguages
, coming from NSLocale
(btw it's a class method, not an object method) represents the system-level preferences of the user.
Therefore, +preferredLocalizations
provides the language the app is actually running in whereas +preferredLanguages
provides the language the user prefers their apps to run in (even if the apps don't yet support it).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With