Unicode operations such as collation and text boundary determination can be affected by the conventions of a particular language or region. CFLocale objects specify language-specific or region-specific information for locale-sensitive operations.
The CFLocale opaque type provides support for obtaining available locales, obtaining localized locale names, and converting among locale data formats. Locale identifiers in macOS follow the IETF’s BCP 47. CFLocale never uses Script Manager codes (except for the legacy support provided by
CFLocaleCreateCanonicalLocaleIdentifierFromScriptManagerCodes(_:_:_:))—the Script Manager and all its concepts are deprecated.
CFLocale is “toll-free bridged” with its Cocoa Foundation counterpart,
NSLocale. This means that the Core Foundation type is interchangeable in function or method calls with the bridged Foundation object. Therefore, in a method where you see an
NSLocale * parameter, you can pass in a
CFLocaleRef, and in a function where you see a
CFLocaleRef parameter, you can pass in an
NSLocale instance. See Toll-Free Bridged Types for more information on toll-free bridging.