displayName(forKey:value:)
Returns the display name for the given locale component value.
Declaration
func displayName(forKey key: NSLocale.Key, value: Any) -> String?Parameters
- key:
The locale property key of
value. For possible values, see 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 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.