Type Method


Returns a dictionary that is the result of parsing a locale ID.


+ (NSDictionary<NSString *,NSString *> *)componentsFromLocaleIdentifier:(NSString *)string;



A locale ID, consisting of language, script, country, variant, and keyword/value pairs, for example, "en_US@calendar=japanese".

Return Value

A dictionary that is the result of parsing string as a locale ID. The keys are the constant NSString constants corresponding to the locale ID components, and the values correspond to constants where available. For possible values, see NSLocaleKey.


For example, the locale identifier "en_US@calendar=japanese" yields a dictionary with three entries: NSLocaleLanguageCode=en, NSLocaleCountryCode=US, and NSLocaleCalendar=NSJapaneseCalendar.

See Also

Converting Between Identifiers

+ canonicalLocaleIdentifierFromString:

Returns the canonical identifier for a given locale identification string.

+ localeIdentifierFromComponents:

Returns a locale identifier from the components specified in a given dictionary.

+ canonicalLanguageIdentifierFromString:

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

+ localeIdentifierFromWindowsLocaleCode:

Returns a locale identifier from a Windows locale code.

+ windowsLocaleCodeFromLocaleIdentifier:

Returns a Window locale code from the locale identifier.