func object(forKey : NSLocale.Key) -> Any?
Returns the value of the component corresponding to the specified key.
指定されたキーに対応する構成要素の値を返します。
struct NSLocale.Key
The keys used to access components of a locale.
あるロケールの構成要素にアクセスするために使われるキー。
Availability 有効性
Technology
key
The locale property key of value
. For possible values, see NSLocale
.
value
のロケールプロパティキー。可能な値として、NSLocale
を見てください。
value
A value for key
.
key
に対する値。
The display name for value
.
value
に対する表示名。
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.
あなたはidentifier
キーを使うことで、別のロケールの言語におけるあるロケールの名前を得ることができます、以下の例で解説するように。
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
locale.
以下の例は、en
ロケールを使います。
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)"
func object(forKey : NSLocale.Key) -> Any?
struct NSLocale.Key