aboutsummaryrefslogtreecommitdiff
path: root/files/ko/web/javascript/reference/global_objects/intl/locale/index.html
blob: a768a8bb5d8d4ebb8ce3f698ac3d9510e681af0b (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
68
69
70
71
72
73
74
75
76
77
---
title: Intl.Locale
slug: Web/JavaScript/Reference/Global_Objects/Intl/Locale
tags:
  - Internationalization
  - Intl
  - JavaScript
  - NeedsTranslation
  - Reference
  - TopicStub
translation_of: Web/JavaScript/Reference/Global_Objects/Intl/Locale
---
<div>{{JSRef}}</div>

<p><span class="seoSummary">The <strong><code>Intl.Locale</code></strong> constructor is a standard built-in property of the Intl object that represents a Unicode locale identifier.</span></p>

<p>{{EmbedInteractiveExample("pages/js/intl-locale.html")}}</p>

<h2 id="Syntax">Syntax</h2>

<pre class="syntaxbox">new Intl.Locale(<var>tag</var> [, <var>options</var>])</pre>

<h3 id="Parameters">Parameters</h3>

<dl>
 <dt><code>tag</code></dt>
 <dd>The Unicode locale identifier string.</dd>
 <dt><code>options</code></dt>
 <dd>An object that contains configuration for the Locale. Keys are Unicode locale tags, values are valid Unicode tag values.</dd>
</dl>

<h2 id="Description">Description</h2>

<p>The <code><strong>Intl.Locale</strong></code> object was created to allow for easier manipulation of Unicode locales. Unicode represents locales with a string, called a <em>locale identifier</em>. The locale identifier consists of a <em>language identifier</em> and <em>extension tags</em>. Language identifiers are the core of the locale, consisting of <em>language</em><em>script</em>, and <em>region subtags</em>. Additional information about the locale is stored in the optional <em>extension tags</em>. Extension tags hold information about locale aspects such as calendar type, clock type, and numbering system type.</p>

<p>Traditionally, the Intl API used strings to represent locales, just as Unicode does. This is a simple and lightweight solution that works well. Adding a Locale class, however, adds ease of parsing and manipulating the language, script, and region, as well as extension tags.</p>

<p><span style="">The Intl.Locale object has the following properties and methods:</span></p>

<h3 id="Properties">Properties</h3>

<dl>
 <dt>{{jsxref("Locale.prototype", "Intl.Locale.prototype")}}</dt>
 <dd>The prototype object for the <code>Locale</code> constructor.</dd>
</dl>

<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/#locale-objects">Intl.Locale proposal</a></td>
   <td>Stage 3</td>
   <td></td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility">Browser compatibility</h2>

<div>


<p>{{Compat("javascript.builtins.Intl.Locale")}}</p>
</div>

<h2 id="See_also">See also</h2>

<ul>
 <li> <a href="https://github.com/zbraniecki/Intl.js/tree/intllocale">The Intl.Locale Polyfill</a></li>
 <li><a href="https://www.unicode.org/reports/tr35/#Canonical_Unicode_Locale_Identifiers">Unicode locale identifiers spec</a></li>
</ul>