---
title: "localeIdentifier(fromComponents:)"
framework: foundation
role: symbol
role_heading: Type Method
path: "foundation/nslocale/localeidentifier(fromcomponents:)"
---

# localeIdentifier(fromComponents:)

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

## Declaration

```swift
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

Return Value A locale identifier created from the components specified in dict.

## Discussion

Discussion This reverses the actions of components(fromLocaleIdentifier:), so for example the dictionary {NSLocaleLanguageCode="en", NSLocaleCountryCode="US", NSLocaleCalendar=NSJapaneseCalendar} becomes "en_US@calendar=japanese".

## See Also

### Related Documentation

- [isoLanguageCodes](foundation/nslocale/isolanguagecodes.md)

### Converting Between Identifiers

- [canonicalLocaleIdentifier(from:)](foundation/nslocale/canonicallocaleidentifier(from:).md)
- [components(fromLocaleIdentifier:)](foundation/nslocale/components(fromlocaleidentifier:).md)
- [canonicalLanguageIdentifier(from:)](foundation/nslocale/canonicallanguageidentifier(from:).md)
- [localeIdentifier(fromWindowsLocaleCode:)](foundation/nslocale/localeidentifier(fromwindowslocalecode:).md)
- [windowsLocaleCode(fromLocaleIdentifier:)](foundation/nslocale/windowslocalecode(fromlocaleidentifier:).md)
