---
title: "displayName(forKey:value:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nslocale/displayname(forkey:value:)"
---

# displayName(forKey:value:)

Returns the display name for the given locale component value.

## Declaration

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

## Parameters

- `key`: The locale property key of value. For possible values, see doc://com.apple.foundation/documentation/Foundation/NSLocale/Key.
- `value`: A value for key.

## Return Value

Return Value The display name for value.

## Discussion

Discussion Not all locale property keys have values with display name values. You can use the identifier key to get the name of a locale in the language of another locale, as illustrated in the following examples. The following example uses the en_GB locale.

## See Also

### Accessing Locale Information by Key

- [object(forKey:)](foundation/nslocale/object(forkey:).md)
- [NSLocale.Key](foundation/nslocale/key.md)
