aboutsummaryrefslogtreecommitdiff
path: root/files/ja/web/javascript/reference/global_objects/intl/displaynames/resolvedoptions/index.md
blob: 8f7593317aa8818ecffa86e54b3d9528957d1215 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
---
title: Intl.DisplayNames.prototype.resolvedOptions()
slug: Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/resolvedOptions
tags:
  - DisplayNames
  - Internationalization
  - Intl
  - JavaScript
  - Localization
  - Method
  - Prototype
  - Reference
browser-compat: javascript.builtins.Intl.DisplayNames.resolvedOptions
translation_of: Web/JavaScript/Reference/Global_Objects/Intl/DisplayNames/resolvedOptions
---
{{JSRef}}

**`Intl.DisplayNames.prototype.resolvedOptions()`** メソッドは、現在の {{jsxref("Intl.DisplayNames")}} オブジェクトの初期化時に計算されたロケールとスタイルの書式オプションを反映したプロパティを持つ新しいオブジェクトを返します。

## 構文

```js
resolvedOptions()
```

### 返値

この {{jsxref("Intl.DisplayNames")}} オブジェクトの初期化時に計算されたロケールと書式オプションを反映したプロパティを持つ新しいオブジェクトです。

## 解説

`resolvedOptions()` で返されるオブジェクトには、以下のプロパティがあります。

- `locale`
  - : このロケールで実際に使用する BCP 47 言語タグです。入力されこのロケールに導いた BCP 47 言語タグで Unicode 拡張値が要求されていた場合、要求されたキーと値の組のうち、このロケールで対応しているものが `locale` に含まれます。
- `style`
  - : コンストラクターの `options` 引数でこのプロパティに与えられた値、または既定値 ("`long`") です。値は "`long`"、"`short`"、"`narrow`" のいずれかです。
- `type`
  - : コンストラクターの `options` 引数でこのプロパティに与えられた値、または既定値 ("`language`") です。値は "`language`"、"`region`"、"`script`"、"`currency`" のいずれかです。
- `fallback`
  - : コンストラクターの `options` 引数でこのプロパティに与えられた値、または既定値 ("`code`") です。値は "`code`" または "`none`" のどちらかです。

## 例

### resolvedOptions の使用

```js
const displayNames = new Intl.DisplayNames(['de-DE'], {type: 'region'});

const usedOptions = displayNames.resolvedOptions();
console.log(usedOptions.locale);   // "de-DE"
console.log(usedOptions.style);    // "long"
console.log(usedOptions.type);     // "region"
console.log(usedOptions.fallback); // "code"
```

## 仕様書

{{Specifications}}

## ブラウザーの互換性

{{Compat}}

## 関連情報

- {{jsxref("Intl.DisplayNames")}}