blob: b9f3fe48a4578ee8ef822450c4747c936b7c0da8 (
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
|
---
title: Intl.Locale.prototype.language
slug: Web/JavaScript/Reference/Global_Objects/Intl/Locale/language
translation_of: Web/JavaScript/Reference/Global_Objects/Intl/Locale/language
---
<div>{{JSRef}}</div>
<p><strong><code>Intl.Locale.prototype.language</code></strong> 속성은 locale과 관련된 언어를 반환하는 접근자 속성입니다.</p>
<h2 id="Description">Description</h2>
<p>언어는 locale의 핵심 기능 중 하나입니다. 유니 코드 사양은 locale의 언어 식별자를 언어와 지역으로 함께 취급합니다 (예를 들어 영국 영어와 미국 영어 등의 방언과 변형을 구별하기 위해). {{jsxref("Locale", "Locale")}}의 language 속성은 로캘의 언어 하위 태그를 엄격하게 반환합니다.</p>
<h2 id="Examples">Examples</h2>
<h3 id="locale_식별자_문자열_인수에서_언어_설정">locale 식별자 문자열 인수에서 언어 설정</h3>
<p>유효한 유니 코드 locale 식별자가 되려면 문자열이 언어 하위 태그로 시작해야합니다. {{jsxref("Locale", "Locale")}} 생성자에 대한 주요 인수는 유효한 유니 코드 locale 식별자여야하므로 생성자가 사용될 때마다 언어 하위 태그가있는 식별자를 전달해야합니다.</p>
<pre class="brush: js">let langStr = new Intl.Locale("en-Latn-US");
console.log(langStr.language); // Prints "en"</pre>
<h3 id="configuration_객체로_언어_오버라이딩_하기">configuration 객체로 언어 오버라이딩 하기</h3>
<p>언어 하위 태그를 지정해야하지만 {{jsxref("Locale", "Locale")}} 생성자는 언어 하위 태그를 재정의 할 수있는 구성 개체를 사용합니다.</p>
<pre class="brush: js">let langObj = new Intl.Locale("en-Latn-US", {language: "es"});
console.log(langObj.language); // Prints "es"</pre>
<h2 id="Specifications">Specifications</h2>
<table class="standard-table">
<tbody>
<tr>
<th scope="col">Specification</th>
<th scope="col">Status</th>
<th scope="col">Comment</th>
</tr>
<tr>
<td><a href="https://tc39.github.io/proposal-intl-locale/#sec-Intl.Locale.prototype.language">Intl.Locale.prototype.language proposal</a></td>
<td>Stage 3</td>
<td></td>
</tr>
</tbody>
</table>
<h2 id="Browser_compatibility">Browser compatibility</h2>
<div>
{{Compat("javascript.builtins.Intl.Locale.language")}}</div>
<h2 id="See_also">See also</h2>
<ul>
<li>{{jsxref("Locale", "Locale")}}</li>
<li><a href="https://www.unicode.org/reports/tr35/#unicode_language_subtag_validity">Unicode language subtag specification</a></li>
</ul>
|