<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSLocale/localeIdentifier(fromComponents:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSLocale(cm)localeIdentifierFromComponents:"
  },
  "title" : "localeIdentifier(fromComponents:)"
}
-->

# localeIdentifier(fromComponents:)

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

```
class func localeIdentifier(fromComponents dict: [String : String]) -> String
```

## Parameters

`dict`

A dictionary containing components that specify a locale. For possible values, see `NSLocale Component Keys`.

## Return Value

A locale identifier created from the components specified in `dict`.

## Discussion

This reverses the actions of [`components(fromLocaleIdentifier:)`](/documentation/Foundation/NSLocale/components(fromLocaleIdentifier:)), so for example the dictionary `{NSLocaleLanguageCode="en", NSLocaleCountryCode="US", NSLocaleCalendar=NSJapaneseCalendar}` becomes `"en_US@calendar=japanese"`.

## See Also

[`ISOLanguageCodes`](/documentation/Foundation/NSLocale/isoLanguageCodes)

The list of known language codes.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)