Mac Developer Library

Developer

CoreFoundation Framework Reference CFLocale Reference

Options
Deployment Target:

On This Page
Language:

CFLocale Reference

Inheritance


Not Applicable

Conforms To


Not Applicable

Import Statement


Swift

import CoreFoundation

Objective-C

@import CoreFoundation;

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 OS X 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.

For more information on locale identifiers, read Internationalization and Localization Guide. It is also useful to read the ICU’s User Guide for the Locale Class.

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.

Functions

  • Returns a copy of the logical locale for the current user.

    Declaration

    Swift

    func CFLocaleCopyCurrent() -> CFLocale!

    Objective-C

    CFLocaleRef CFLocaleCopyCurrent ( void );

    Return Value

    The logical locale for the current user that is formed from the settings for the current user’s chosen system locale overlaid with any custom settings the user has specified in System Preferences. May return a retained cached object, not a new object. Ownership follows the Create Rule.

    Discussion

    Settings you get from this locale do not change as a user's preferences are changed so that your operations are consistent. Typically you perform some operations on the returned object and then release it. Since the returned object may be cached, you do not need to hold on to it indefinitely.

    Note that locale settings are independent of the user’s language setting. The language of the current locale may not correspond to the language at the first index in the AppleLanguages array from user defaults. For more details, see Locale Concepts in Locales Programming Guide; see also CFLocaleCopyPreferredLanguages.

    Import Statement

    Objective-C

    @import CoreFoundation;

    Swift

    import CoreFoundation

    Availability

    Available in OS X v10.3 and later.

  • Creates a locale for the given arbitrary locale identifier.

    Declaration

    Swift

    func CFLocaleCreate(_ allocator: CFAllocator!, _ localeIdentifier: CFString!) -> CFLocale!

    Objective-C

    CFLocaleRef CFLocaleCreate ( CFAllocatorRef allocator, CFStringRef localeIdentifier );

    Parameters

    allocator

    The allocator to use to allocate memory for the new object. Pass NULL or kCFAllocatorDefault to use the current default allocator.

    localeIdentifier

    A string representation of an arbitrary locale identifier.

    Return Value

    A new locale that corresponds to the arbitrary locale identifier localeIdentifier. Returns NULL if there was a problem creating the object. Ownership follows the Create Rule.

    Import Statement

    Objective-C

    @import CoreFoundation;

    Swift

    import CoreFoundation

    Availability

    Available in OS X v10.3 and later.

  • Returns a copy of a locale.

    Declaration

    Swift

    func CFLocaleCreateCopy(_ allocator: CFAllocator!, _ locale: CFLocale!) -> CFLocale!

    Objective-C

    CFLocaleRef CFLocaleCreateCopy ( CFAllocatorRef allocator, CFLocaleRef locale );

    Parameters

    allocator

    The allocator to use to allocate memory for the new object. Pass NULL or kCFAllocatorDefault to use the current default allocator.

    locale

    The locale object to copy.

    Return Value

    A new locale that is a copy of locale. Returns NULL if there was a problem creating the object. Ownership follows the Create Rule.

    Import Statement

    Objective-C

    @import CoreFoundation;

    Swift

    import CoreFoundation

    Availability

    Available in OS X v10.3 and later.

  • Returns the root, canonical locale.

    Declaration

    Swift

    func CFLocaleGetSystem() -> CFLocale!

    Objective-C

    CFLocaleRef CFLocaleGetSystem ( void );

    Return Value

    The root, canonical locale. Ownership follows the Get Rule.

    Discussion

    The root locale contains fixed backstop settings for all locale information.

    Import Statement

    Objective-C

    @import CoreFoundation;

    Swift

    import CoreFoundation

    Availability

    Available in OS X v10.3 and later.

  • Returns an array of CFString objects that represents all locales for which locale data is available.

    Declaration

    Swift

    func CFLocaleCopyAvailableLocaleIdentifiers() -> CFArray!

    Objective-C

    CFArrayRef CFLocaleCopyAvailableLocaleIdentifiers ( void );

    Return Value

    An array of CFString objects that represents all locales for which locale data is available. Ownership follows the Create Rule.

    Import Statement

    Objective-C

    @import CoreFoundation;

    Swift

    import CoreFoundation

    Availability

    Available in OS X v10.4 and later.

  • Returns an array of CFString objects that represents all known legal ISO country codes.

    Declaration

    Swift

    func CFLocaleCopyISOCountryCodes() -> CFArray!

    Objective-C

    CFArrayRef CFLocaleCopyISOCountryCodes ( void );

    Return Value

    An array of CFString objects that represents all known legal ISO country codes. Ownership follows the Create Rule.

    Discussion

    Note: many of these will not have any supporting locale data in OS X.

    Import Statement

    Objective-C

    @import CoreFoundation;

    Swift

    import CoreFoundation

    Availability

    Available in OS X v10.4 and later.

  • Returns an array of CFString objects that represents all known legal ISO language codes.

    Declaration

    Swift

    func CFLocaleCopyISOLanguageCodes() -> CFArray!

    Objective-C

    CFArrayRef CFLocaleCopyISOLanguageCodes ( void );

    Return Value

    An array of CFString objects that represents all known legal ISO language codes. Ownership follows the Create Rule.

    Discussion

    Note: many of these will not have any supporting locale data in OS X.

    Import Statement

    Objective-C

    @import CoreFoundation;

    Swift

    import CoreFoundation

    Availability

    Available in OS X v10.4 and later.

  • Returns an array of CFString objects that represents all known legal ISO currency codes.

    Declaration

    Swift

    func CFLocaleCopyISOCurrencyCodes() -> CFArray!

    Objective-C

    CFArrayRef CFLocaleCopyISOCurrencyCodes ( void );

    Return Value

    An array of CFString objects that represents all known legal ISO currency codes.Ownership follows the Create Rule.

    Discussion

    Note: many of these will not have any supporting locale data in OS X.

    Import Statement

    Objective-C

    @import CoreFoundation;

    Swift

    import CoreFoundation

    Availability

    Available in OS X v10.4 and later.

  • Returns an array of strings that represents ISO currency codes for currencies in common use.

    Declaration

    Swift

    func CFLocaleCopyCommonISOCurrencyCodes() -> CFArray!

    Objective-C

    CFArrayRef CFLocaleCopyCommonISOCurrencyCodes ( void );

    Return Value

    An array of CFString objects that represents ISO currency codes for currencies in common use. Ownership follows the Create Rule.

    Import Statement

    Objective-C

    @import CoreFoundation;

    Swift

    import CoreFoundation

    Availability

    Available in OS X v10.5 and later.

  • Returns the array of canonicalized locale IDs that the user prefers.

    Declaration

    Swift

    func CFLocaleCopyPreferredLanguages() -> CFArray!

    Objective-C

    CFArrayRef CFLocaleCopyPreferredLanguages ( void );

    Return Value

    The array of canonicalized CFString locale IDs that the current user prefers. Ownership follows the Create Rule.

    Import Statement

    Objective-C

    @import CoreFoundation;

    Swift

    import CoreFoundation

    Availability

    Available in OS X v10.5 and later.

  • Returns the display name for the given value.

    Declaration

    Swift

    func CFLocaleCopyDisplayNameForPropertyValue(_ displayLocale: CFLocale!, _ key: CFString!, _ value: CFString!) -> CFString!

    Objective-C

    CFStringRef CFLocaleCopyDisplayNameForPropertyValue ( CFLocaleRef displayLocale, CFStringRef key, CFStringRef value );

    Parameters

    displayLocale

    A locale object.

    key

    A string that identifies the type that value is. It must be one of the standard locale property keys (see Locale Property Keys).

    value

    The value for which the display name is required.

    Return Value

    The display name for value. Returns NULL if there was a problem creating the object. Ownership follows the Create Rule.

    Discussion

    Note that not all locale property keys have values with display name values.

    Import Statement

    Objective-C

    @import CoreFoundation;

    Swift

    import CoreFoundation

    Availability

    Available in OS X v10.4 and later.

  • Returns the corresponding value for the given key of a locale’s key-value pair.

    Declaration

    Swift

    func CFLocaleGetValue(_ locale: CFLocale!, _ key: CFString!) -> AnyObject!

    Objective-C

    CFTypeRef CFLocaleGetValue ( CFLocaleRef locale, CFStringRef key );

    Parameters

    locale

    The locale object to examine.

    key

    The key for which to obtain the corresponding value. Possible values are described in Locale Property Keys.

    Return Value

    The value corresponding to the given key in locale. The value may be any type of CFType object. Ownership follows the Get Rule.

    Discussion

    Locale objects use key-value pairs to store property values. Use this function to get the value of a specific property.

    Import Statement

    Objective-C

    @import CoreFoundation;

    Swift

    import CoreFoundation

    Availability

    Available in OS X v10.3 and later.

  • Returns the given locale's identifier.

    Declaration

    Swift

    func CFLocaleGetIdentifier(_ locale: CFLocale!) -> CFString!

    Objective-C

    CFStringRef CFLocaleGetIdentifier ( CFLocaleRef locale );

    Parameters

    locale

    The locale object to examine.

    Return Value

    A string representation of locale’s identifier. This may not be the same string that was used to create the locale—it may be canonicalized. Ownership follows the Get Rule.

    Import Statement

    Objective-C

    @import CoreFoundation;

    Swift

    import CoreFoundation

    Availability

    Available in OS X v10.3 and later.

  • Returns a canonical locale identifier from given language and region codes.

    Declaration

    Swift

    func CFLocaleCreateCanonicalLocaleIdentifierFromScriptManagerCodes(_ allocator: CFAllocator!, _ lcode: LangCode, _ rcode: RegionCode) -> CFString!

    Objective-C

    CFStringRef CFLocaleCreateCanonicalLocaleIdentifierFromScriptManagerCodes ( CFAllocatorRef allocator, LangCode lcode, RegionCode rcode );

    Parameters

    allocator

    The allocator to use to allocate memory for the new object. Pass NULL or kCFAllocatorDefault to use the current default allocator.

    lcode

    An OS X language code.

    rcode

    An OS X region code.

    Return Value

    A canonical locale identifier created by mapping lcode and rcode to a locale. Returns NULL if there was a problem creating the object. Ownership follows the Create Rule.

    Import Statement

    Objective-C

    @import CoreFoundation;

    Swift

    import CoreFoundation

    Availability

    Available in OS X v10.3 and later.

  • Returns a canonical language identifier by mapping an arbitrary locale identification string to the canonical identifier

    Declaration

    Swift

    func CFLocaleCreateCanonicalLanguageIdentifierFromString(_ allocator: CFAllocator!, _ localeIdentifier: CFString!) -> CFString!

    Objective-C

    CFStringRef CFLocaleCreateCanonicalLanguageIdentifierFromString ( CFAllocatorRef allocator, CFStringRef localeIdentifier );

    Parameters

    allocator

    The allocator to use to allocate memory for the new object. Pass NULL or kCFAllocatorDefault to use the current default allocator.

    localeIdentifier

    A string representation of an arbitrary locale identifier.

    Return Value

    A string that represents the canonical language identifier for the specified arbitrary locale identifier. Returns NULL if there was a problem creating the object. Ownership follows the Create Rule.

    Import Statement

    Objective-C

    @import CoreFoundation;

    Swift

    import CoreFoundation

    Availability

    Available in OS X v10.4 and later.

  • Returns a canonical locale identifier by mapping an arbitrary locale identification string to the canonical identifier.

    Declaration

    Swift

    func CFLocaleCreateCanonicalLocaleIdentifierFromString(_ allocator: CFAllocator!, _ localeIdentifier: CFString!) -> CFString!

    Objective-C

    CFStringRef CFLocaleCreateCanonicalLocaleIdentifierFromString ( CFAllocatorRef allocator, CFStringRef localeIdentifier );

    Parameters

    allocator

    The allocator to use to allocate memory for the new object. Pass NULL or kCFAllocatorDefault to use the current default allocator.

    localeIdentifier

    A string representation of an arbitrary locale identifier (for example, “English”).

    Return Value

    A canonical locale identifier created by mapping the arbitrary locale identification string to the canonical identifier for the corresponding locale (for example, “en”). Returns NULL if there was a problem creating the object. Ownership follows the Create Rule.

    Import Statement

    Objective-C

    @import CoreFoundation;

    Swift

    import CoreFoundation

    Availability

    Available in OS X v10.3 and later.

  • Returns a dictionary containing the result from parsing a locale ID consisting of language, script, country, variant, and keyword/value pairs.

    Declaration

    Swift

    func CFLocaleCreateComponentsFromLocaleIdentifier(_ allocator: CFAllocator!, _ localeID: CFString!) -> CFDictionary!

    Objective-C

    CFDictionaryRef CFLocaleCreateComponentsFromLocaleIdentifier ( CFAllocatorRef allocator, CFStringRef localeID );

    Parameters

    allocator

    The allocator to use to allocate memory for the new object. Pass NULL or kCFAllocatorDefault to use the current default allocator.

    localeID

    The locale ID to be used when creating the locale dictionary.

    Return Value

    A dictionary containing the result from parsing a locale ID consisting of language, script, country, variant, and keyword/value pairs. Returns NULL if there was a problem creating the object. Ownership follows the Create Rule.

    Discussion

    The dictionary keys are the constant CFString objects that correspond to the locale ID components; the values correspond to constants where available. For example: the string "en_US@calendar=japanese" yields a dictionary with three entries: kCFLocaleLanguageCode=en, kCFLocaleCountryCode=US, and kCFLocaleCalendarIdentifier=kCFJapaneseCalendar. See also CFLocaleCreateLocaleIdentifierFromComponents.

    Import Statement

    Objective-C

    @import CoreFoundation;

    Swift

    import CoreFoundation

    Availability

    Available in OS X v10.4 and later.

  • Returns a locale identifier consisting of language, script, country, variant, and keyword/value pairs derived from a dictionary containing the source information.

    Declaration

    Swift

    func CFLocaleCreateLocaleIdentifierFromComponents(_ allocator: CFAllocator!, _ dictionary: CFDictionary!) -> CFString!

    Objective-C

    CFStringRef CFLocaleCreateLocaleIdentifierFromComponents ( CFAllocatorRef allocator, CFDictionaryRef dictionary );

    Parameters

    allocator

    The allocator to use to allocate memory for the new object. Pass NULL or kCFAllocatorDefault to use the current default allocator.

    dictionary

    The dictionary to use when creating the locale identifier.

    Return Value

    A locale identifier consisting of language, script, country, variant, and keyword/value pairs derived from dictionary. Returns NULL if there was a problem creating the string. Ownership follows the Create Rule.

    Discussion

    Reverses the actions of CFLocaleCreateComponentsFromLocaleIdentifier, creating a single string from the data in the specified dictionary. For example, the dictionary {kCFLocaleLanguageCode=en, kCFLocaleCountryCode=US, kCFLocaleCalendarIdentifier=kCFJapaneseCalendar} becomes "en_US@calendar=japanese".

    Import Statement

    Objective-C

    @import CoreFoundation;

    Swift

    import CoreFoundation

    Availability

    Available in OS X v10.4 and later.

  • Returns a locale identifier from a Windows locale code.

    Declaration

    Swift

    func CFLocaleCreateLocaleIdentifierFromWindowsLocaleCode(_ allocator: CFAllocator!, _ lcid: UInt32) -> CFString!

    Objective-C

    CFStringRef CFLocaleCreateLocaleIdentifierFromWindowsLocaleCode ( CFAllocatorRef allocator, uint32_t lcid );

    Parameters

    allocator

    The allocator to use to allocate memory for the new object. Pass NULL or kCFAllocatorDefault to use the current default allocator.

    lcid

    The Windows locale code.

    Return Value

    The locale identifier.

    Import Statement

    Objective-C

    @import CoreFoundation;

    Swift

    import CoreFoundation

    Availability

    Available in OS X v10.6 and later.

  • Returns a Windows locale code from the locale identifier.

    Declaration

    Swift

    func CFLocaleGetWindowsLocaleCodeFromLocaleIdentifier(_ localeIdentifier: CFString!) -> UInt32

    Objective-C

    uint32_t CFLocaleGetWindowsLocaleCodeFromLocaleIdentifier ( CFStringRef localeIdentifier );

    Parameters

    localeIdentifier

    The locale identifier.

    Return Value

    The Windows locale code.

    Import Statement

    Objective-C

    @import CoreFoundation;

    Swift

    import CoreFoundation

    Availability

    Available in OS X v10.6 and later.

  • Returns the type identifier for the CFLocale opaque type.

    Declaration

    Swift

    func CFLocaleGetTypeID() -> CFTypeID

    Objective-C

    CFTypeID CFLocaleGetTypeID ( void );

    Return Value

    The type identifier for the CFLocale opaque type.

    Import Statement

    Objective-C

    @import CoreFoundation;

    Swift

    import CoreFoundation

    Availability

    Available in OS X v10.3 and later.

Data Types

Miscellaneous

  • A reference to a CFLocale object.

    Declaration

    Swift

    typealias CFLocaleRef = CFLocale

    Objective-C

    typedef const struct __CFLocale *CFLocaleRef;

    Import Statement

    Objective-C

    @import CoreFoundation;

    Swift

    import CoreFoundation

    Availability

    Available in OS X version 10.3 and later.

Constants

Miscellaneous

  • These constants describe the text direction for a language. They are returned by the functions CFLocaleGetLanguageCharacterDirection and CFLocaleGetLanguageLineDirection.

    Declaration

    Swift

    enum CFLocaleLanguageDirection : CFIndex { case Unknown case LeftToRight case RightToLeft case TopToBottom case BottomToTop }

    Objective-C

    typedef enum : CFIndex { kCFLocaleLanguageDirectionUnknown = 0, kCFLocaleLanguageDirectionLeftToRight = 1, kCFLocaleLanguageDirectionRightToLeft = 2, kCFLocaleLanguageDirectionTopToBottom = 3, kCFLocaleLanguageDirectionBottomToTop = 4 } CFLocaleLanguageDirection;

    Constants

    • Unknown

      kCFLocaleLanguageDirectionUnknown

      The direction of the language is unknown.

      Available in OS X v10.6 and later.

    • LeftToRight

      kCFLocaleLanguageDirectionLeftToRight

      The language direction is from left to right.

      Available in OS X v10.6 and later.

    • RightToLeft

      kCFLocaleLanguageDirectionRightToLeft

      The language direction is from right to left.

      Available in OS X v10.6 and later.

    • TopToBottom

      kCFLocaleLanguageDirectionTopToBottom

      The language direction is from top to bottom.

      Available in OS X v10.6 and later.

    • BottomToTop

      kCFLocaleLanguageDirectionBottomToTop

      The language direction is from bottom to top.

      Available in OS X v10.6 and later.

    Import Statement

    Objective-C

    @import CoreFoundation;

    Swift

    import CoreFoundation

    Availability

    Available in OS X v10.6 and later.

  • Predefined locale keys used to get property values.

    Declaration

    Swift

    let kCFLocaleIdentifier: CFString! let kCFLocaleLanguageCode: CFString! let kCFLocaleCountryCode: CFString! let kCFLocaleScriptCode: CFString! let kCFLocaleVariantCode: CFString! let kCFLocaleExemplarCharacterSet: CFString! let kCFLocaleCalendarIdentifier: CFString! let kCFLocaleCalendar: CFString! let kCFLocaleCollationIdentifier: CFString! let kCFLocaleUsesMetricSystem: CFString! let kCFLocaleMeasurementSystem: CFString! let kCFLocaleDecimalSeparator: CFString! let kCFLocaleGroupingSeparator: CFString! let kCFLocaleCurrencySymbol: CFString! let kCFLocaleCurrencyCode: CFString! let kCFLocaleCollatorIdentifier: CFString! let kCFLocaleQuotationBeginDelimiterKey: CFString! let kCFLocaleQuotationEndDelimiterKey: CFString! let kCFLocaleAlternateQuotationBeginDelimiterKey: CFString! let kCFLocaleAlternateQuotationEndDelimiterKey: CFString!

    Objective-C

    const CFStringRef kCFLocaleIdentifier; const CFStringRef kCFLocaleLanguageCode; const CFStringRef kCFLocaleCountryCode; const CFStringRef kCFLocaleScriptCode; const CFStringRef kCFLocaleVariantCode; const CFStringRef kCFLocaleExemplarCharacterSet; const CFStringRef kCFLocaleCalendarIdentifier; const CFStringRef kCFLocaleCalendar; const CFStringRef kCFLocaleCollationIdentifier; const CFStringRef kCFLocaleUsesMetricSystem; const CFStringRef kCFLocaleMeasurementSystem; const CFStringRef kCFLocaleDecimalSeparator; const CFStringRef kCFLocaleGroupingSeparator; const CFStringRef kCFLocaleCurrencySymbol; const CFStringRef kCFLocaleCurrencyCode; const CFStringRef kCFLocaleCollatorIdentifier; const CFStringRef kCFLocaleQuotationBeginDelimiterKey; const CFStringRef kCFLocaleQuotationEndDelimiterKey; const CFStringRef kCFLocaleAlternateQuotationBeginDelimiterKey; const CFStringRef kCFLocaleAlternateQuotationEndDelimiterKey;

    Constants

    • kCFLocaleIdentifier

      kCFLocaleIdentifier

      Specifies locale identifier.

      The corresponding value is a CFString containing the POSIX locale identifier as used by ICU, such as “ja_JP”. If you have a variant locale or a different currency or calendar, it can be as complex as “en_US_POSIX@calendar=japanese;currency=EUR” or “az_Cyrl_AZ@calendar=buddhist;currency=JPY”.

      Available in OS X v10.4 and later.

    • kCFLocaleLanguageCode

      kCFLocaleLanguageCode

      Specifies the locale language code.

      The corresponding value is a CFString containing an ISO 639-x/IETF BCP 47 language identifier, such as “ja”.

      Available in OS X v10.4 and later.

    • kCFLocaleCountryCode

      kCFLocaleCountryCode

      Specifies the locale country code.

      The corresponding value is a CFString containing an ISO county code, such as “JP”.

      Available in OS X v10.4 and later.

    • kCFLocaleScriptCode

      kCFLocaleScriptCode

      Specifies the locale script code.

      The corresponding value is a CFString containing a Unicode script tag (strictly, an ISO 15924 script tag). Usually this is empty (it is for “ja_JP”). It may be present for locales where a script must be specified, for example “uz-Latn-UZ” vs. “uz-Cyrl-UZ” for Uzbek in Latin vs. Cyrillic (in the first case the script code is “Latn”, and in the second it is “Cyrl”).

      Available in OS X v10.4 and later.

    • kCFLocaleVariantCode

      kCFLocaleVariantCode

      Specifies the locale variant code.

      The corresponding value is a CFString containing the variant name. The variant code is arbitrary and application-specific. ICU adds “_EURO” to its locale designations for locales that support the Euro currency. For “en_US_POSIX” the variant is “POSIX”, and for “hy_AM_REVISED” it is “REVISED”.

      Available in OS X v10.4 and later.

    • kCFLocaleExemplarCharacterSet

      kCFLocaleExemplarCharacterSet

      Specifies the locale character set.

      Available in OS X v10.4 and later.

    • kCFLocaleCalendarIdentifier

      kCFLocaleCalendarIdentifier

      Specifies the locale calendar identifier.

      The corresponding value is a CFString containing the calendar identifier (for possible values, see “Locale Calendar Identifiers”).

      Available in OS X v10.4 and later.

    • kCFLocaleCalendar

      kCFLocaleCalendar

      Specifies the locale calendar.

      The corresponding value is a CFCalendar object.

      Available in OS X v10.4 and later.

    • kCFLocaleCollationIdentifier

      kCFLocaleCollationIdentifier

      Specifies the locale collation identifier.

      The corresponding value is a collation.

      Available in OS X v10.4 and later.

    • kCFLocaleUsesMetricSystem

      kCFLocaleUsesMetricSystem

      Specifies the whether the locale uses the metric system.

      The corresponding value is a CFBoolean.

      Available in OS X v10.4 and later.

    • kCFLocaleMeasurementSystem

      kCFLocaleMeasurementSystem

      Specifies the measurement system used.

      The corresponding value is a CFString object, for example “Metric” or “U.S.”.

      Available in OS X v10.3 and later.

    • kCFLocaleDecimalSeparator

      kCFLocaleDecimalSeparator

      Specifies the decimal point string.

      The corresponding value is a CFString object, for example “.” or “,”.

      Available in OS X v10.3 and later.

    • kCFLocaleGroupingSeparator

      kCFLocaleGroupingSeparator

      Specifies the separator string between groups of digits.

      The corresponding value is a CFString object, for example “,” or “.”.

      Available in OS X v10.3 and later.

    • kCFLocaleCurrencySymbol

      kCFLocaleCurrencySymbol

      Specifies the currency symbol.

      The corresponding value is a CFString object, for example “$” or “£”.

      Available in OS X v10.3 and later.

    • kCFLocaleCurrencyCode

      kCFLocaleCurrencyCode

      Specifies the locale currency code.

      The corresponding value is a CFString object, for example “USD” or “GBP”.

      Available in OS X v10.3 and later.

    • kCFLocaleCollatorIdentifier

      kCFLocaleCollatorIdentifier

      Specifies the collation identifier for the locale.

      The corresponding value is a CFString object. If unknown, nil is returned.

      Available in OS X v10.6 and later.

    • kCFLocaleQuotationBeginDelimiterKey

      kCFLocaleQuotationBeginDelimiterKey

      Specifies the the begin quotation symbol associated with the locale.

      The corresponding value is a CFString object.

      Available in OS X v10.6 and later.

    • kCFLocaleQuotationEndDelimiterKey

      kCFLocaleQuotationEndDelimiterKey

      Specifies the end quotation symbol associated with the locale.

      The corresponding value is a CFString object.

      Available in OS X v10.6 and later.

    • kCFLocaleAlternateQuotationBeginDelimiterKey

      kCFLocaleAlternateQuotationBeginDelimiterKey

      Specifies the alternating begin quotation symbol associated with the locale. In some locales, when quotations are nested, the quotation characters alternate. Thus, NSLocaleQuotationBeginDelimiterKey, then NSLocaleAlternateQuotationBeginDelimiterKey, and so on.

      The corresponding value is a CFString object.

      Available in OS X v10.6 and later.

    • kCFLocaleAlternateQuotationEndDelimiterKey

      kCFLocaleAlternateQuotationEndDelimiterKey

      Specifies the alternating end quotation symbol associated with the locale. In some locales, when quotations are nested, the quotation characters alternate. Thus, NSLocaleQuotationEndDelimiterKey, then NSLocaleAlternateQuotationEndDelimiterKey, and so on.

      The corresponding value is a CFString object.

      Available in OS X v10.6 and later.

    Discussion

    Locale objects use key-value pairs to store property values. Use the CFLocaleGetValue function to get the value of a specific property listed above.

  • Predefined locale keys used to get calendar values—values for kCFLocaleCalendarIdentifier.

    Declaration

    Swift

    let kCFGregorianCalendar: CFString! let kCFBuddhistCalendar: CFString! let kCFChineseCalendar: CFString! let kCFHebrewCalendar: CFString! let kCFIslamicCalendar: CFString! let kCFIslamicCivilCalendar: CFString! let kCFIslamicTabularCalendar: CFString! let kCFIslamicUmmAlQuraCalendar: CFString! let kCFJapaneseCalendar: CFString! let kCFRepublicOfChinaCalendar: CFString! let kCFPersianCalendar: CFString! let kCFIndianCalendar: CFString! let kCFISO8601Calendar: CFString!

    Objective-C

    const CFStringRef kCFGregorianCalendar; const CFStringRef kCFBuddhistCalendar; const CFStringRef kCFChineseCalendar; const CFStringRef kCFHebrewCalendar; const CFStringRef kCFIslamicCalendar; const CFStringRef kCFIslamicCivilCalendar; const CFStringRef kCFIslamicTabularCalendar; const CFStringRef kCFIslamicUmmAlQuraCalendar; const CFStringRef kCFJapaneseCalendar; const CFStringRef kCFRepublicOfChinaCalendar; const CFStringRef kCFPersianCalendar; const CFStringRef kCFIndianCalendar; const CFStringRef kCFISO8601Calendar;

    Constants

    • kCFGregorianCalendar

      kCFGregorianCalendar

      Specifies the Gregorian calendar.

      Available in OS X v10.3 and later.

    • kCFBuddhistCalendar

      kCFBuddhistCalendar

      Specifies the Buddhist calendar.

      Available in OS X v10.4 and later.

    • kCFChineseCalendar

      kCFChineseCalendar

      Specifies the Chinese calendar.

      Available in OS X v10.4 and later.

    • kCFHebrewCalendar

      kCFHebrewCalendar

      Specifies the Hebrew calendar.

      Available in OS X v10.4 and later.

    • kCFIslamicCalendar

      kCFIslamicCalendar

      Specifies the Islamic calendar.

      Available in OS X v10.4 and later.

    • kCFIslamicCivilCalendar

      kCFIslamicCivilCalendar

      Specifies the Islamic tabular calendar with Friday (civil) origin.

      Available in OS X v10.4 and later.

    • kCFIslamicTabularCalendar

      kCFIslamicTabularCalendar

      Specifies the Islamic tabular calendar with Thursday (astronomical) origin.

      Available in OS X v10.10 and later.

    • kCFIslamicUmmAlQuraCalendar

      kCFIslamicUmmAlQuraCalendar

      Specifies the Islamic Umm Al Qura calendar.

      Available in OS X v10.10 and later.

    • kCFJapaneseCalendar

      kCFJapaneseCalendar

      Specifies the Japanese calendar.

      Available in OS X v10.4 and later.

    • kCFRepublicOfChinaCalendar

      kCFRepublicOfChinaCalendar

      Specifies the calendar for the Republic of China.

      Available in OS X v10.6 and later.

    • kCFPersianCalendar

      kCFPersianCalendar

      Specifies the Persian calendar.

      Available in OS X v10.6 and later.

    • kCFIndianCalendar

      kCFIndianCalendar

      Specifies the Indian calendar.

      Available in OS X v10.6 and later.

    • kCFISO8601Calendar

      kCFISO8601Calendar

      Specifies the ISO 8601 calendar.

      Available in OS X v10.6 and later.

    Discussion

    Locale objects use key-value pairs to store property values. Use the CFLocaleGetValue function to get the value of a specific property listed above.

  • Identifier for notification sent if the current locale changes.

    Declaration

    Swift

    let kCFLocaleCurrentLocaleDidChangeNotification: CFString!

    Objective-C

    const CFStringRef kCFLocaleCurrentLocaleDidChangeNotification

    Constants

    • kCFLocaleCurrentLocaleDidChangeNotification

      kCFLocaleCurrentLocaleDidChangeNotification

      Identifier for the notification sent if the current locale changes.

      This is a local notification posted when the user changes locale information in the System Preferences panel. Keep in mind that there is no order in how notifications are delivered to observers; frameworks or other parts of your code may also be observing this notification to take their own actions, and these may not have occurred at the time you receive the notification.

      There is no object or user info for this notification.

      Available in OS X v10.5 and later.