<!--
{
  "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/displayName(forKey:value:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSLocale(im)displayNameForKey:value:"
  },
  "title" : "displayName(forKey:value:)"
}
-->

# displayName(forKey:value:)

Returns the display name for the given locale component value.

```
func displayName(forKey key: NSLocale.Key, value: Any) -> String?
```

## Parameters

`key`

The locale property key of `value`. For possible values, see [`NSLocale.Key`](/documentation/Foundation/NSLocale/Key).

`value`

A value for `key`.

## Return Value

The display name for `value`.

## Discussion

Not all locale property keys have values with display name values.

You can use the [`identifier`](/documentation/Foundation/NSLocale/Key/identifier) key to get the name of a locale in the language of another locale, as illustrated in the following examples.

```swift
let frLocale = NSLocale(localeIdentifier: "fr_FR")
print(frLocale.displayNameForKey(NSLocaleIdentifier, value: "fr_FR")!)
// "français (France)"
print(frLocale.displayNameForKey(NSLocaleIdentifier, value: "en_US")!)
// "anglais (États-Unis)"
```

The following example uses the `en_GB` locale.

```swift
let gbLocale = NSLocale(localeIdentifier: "en_GB")
print(gbLocale.displayNameForKey(NSLocaleIdentifier, value: "fr_FR")!)
// "French (France)"
print(gbLocale.displayNameForKey(NSLocaleIdentifier, value: "en_US")!)
// "English (United States)"
```

---

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)