aboutsummaryrefslogtreecommitdiff
path: root/files/ko/web/javascript/reference/global_objects/intl/numberformat
diff options
context:
space:
mode:
Diffstat (limited to 'files/ko/web/javascript/reference/global_objects/intl/numberformat')
-rw-r--r--files/ko/web/javascript/reference/global_objects/intl/numberformat/index.html198
-rw-r--r--files/ko/web/javascript/reference/global_objects/intl/numberformat/prototype/index.html85
2 files changed, 283 insertions, 0 deletions
diff --git a/files/ko/web/javascript/reference/global_objects/intl/numberformat/index.html b/files/ko/web/javascript/reference/global_objects/intl/numberformat/index.html
new file mode 100644
index 0000000000..6d306a0c77
--- /dev/null
+++ b/files/ko/web/javascript/reference/global_objects/intl/numberformat/index.html
@@ -0,0 +1,198 @@
+---
+title: Intl.NumberFormat
+slug: Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat
+tags:
+ - Internationalization
+ - Intl
+ - JavaScript
+ - NumberFormat
+ - Reference
+translation_of: Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat
+---
+<div>{{JSRef}}</div>
+
+<p><strong><code>Intl.NumberFormat</code></strong>은 언어에 맞는 숫자 서식을 지원하는 객체의 생성자입니다.</p>
+
+<div>{{EmbedInteractiveExample("pages/js/intl-numberformat.html")}}</div>
+
+<p class="hidden">상호작용 가능한 예제의 소스는 GitHub 리포지토리에 보관되어 있습니다. 상호작용 예제 프로젝트에 기여하고 싶으시다면, <a href="https://github.com/mdn/interactive-examples">https://github.com/mdn/interactive-examples</a>를 클론한 후 풀 리퀘스트를 보내주세요.</p>
+
+<h2 id="구문">구문</h2>
+
+<pre class="syntaxbox">new Intl.NumberFormat([<var>locales</var>[, <var>options</var>]])
+Intl.NumberFormat.call(<var>this</var>[, <var>locales</var>[, <var>options</var>]])
+</pre>
+
+<h3 id="매개_변수">매개 변수</h3>
+
+<dl>
+ <dt><code>locales</code> {{optional_inline}}</dt>
+ <dd>
+ <p><a href="https://ko.wikipedia.org/wiki/IETF_%EC%96%B8%EC%96%B4_%ED%83%9C%EA%B7%B8">BCP 47</a> 언어 태그를 포함하는 문자열이나 문자열의 배열. 로케일 매개변수의 일반적인 형식 및 해석은 {{jsxref("Intl", "<code>Intl</code> 문서", "#Locale_identification_and_negotiation", 1)}}를 참고하세요. 다음의 Unicode 확장 키를 사용할 수 있습니다.</p>
+
+ <dl>
+ <dt><code>nu</code></dt>
+ <dd>사용할 기수법. <code>"arab"</code>, <code>"arabext"</code>, <code>"bali"</code>, <code>"beng"</code>, <code>"deva"</code>, <code>"fullwide"</code>, <code>"gujr"</code>, <code>"guru"</code>, <code>"hanidec"</code>, <code>"khmr"</code>, <code>"knda"</code>, <code>"laoo"</code>, <code>"latn"</code>, <code>"limb"</code>, <code>"mlym"</code>, <code>"mong"</code>, <code>"mymr"</code>, <code>"orya"</code>, <code>"tamldec"</code>, <code>"telu"</code>, <code>"thai"</code>, <code>"tibt"</code> 등을 사용할 수 있습니다.</dd>
+ </dl>
+ </dd>
+ <dt><code>options</code> {{optional_inline}}</dt>
+ <dd>
+ <p>다음 속성을 포함하는 객체.</p>
+
+ <dl>
+ <dt><code>localeMatcher</code></dt>
+ <dd>사용할 로케일 매칭 알고리즘. 가능한 값은 <code>"lookup"</code>과 <code>"best fit"</code>이고, 기본값은 <code>"best fit"</code>입니다. 자세한 정보는 {{jsxref("Intl", "<code>Intl</code> 문서", "#로케일_조정", 1)}}를 참고하세요.</dd>
+ <dt><code>style</code></dt>
+ <dd>사용할 서식 스타일. 가능한 값은 평문 숫자 <code>"decimal"</code>, 통화 서식 <code>"currency"</code>, 백분율 서식 <code>"percent"</code>입니다. 기본값은 <code>"decimal"</code>입니다.</dd>
+ <dt><code>currency</code></dt>
+ <dd>통화 서식에 사용할 통화입니다. 가능한 값은 <a href="https://ko.wikipedia.org/wiki/ISO_4217">ISO 4217 통화 코드</a>로 대한민국 원화 <code>"KRW"</code>, 미국 달러화 <code>"USD"</code>, 유럽 유로화 <code>"EUR"</code> 등을 포함합니다. <a href="http://www.currency-iso.org/en/home/tables/table-a1.html">현재 통화 및 펀드 코드 목록</a>을 참고하세요. 기본값은 없습니다. <code>style</code> 값을 <code>"currency"</code>로 지정했다면, <code>currency</code> 값도 반드시 지정해야 합니다.</dd>
+ <dt><code>currencyDisplay</code></dt>
+ <dd>통화 서식에서 통화를 표시하는 방법. 가능한 값은 €와 같이 현지 통화 기호를 사용하는 <code>"symbol"</code>, ISO 통화 코드를 사용하는 <code>"code"</code>, <code>"dollar"</code> 등 현지 통화 이름을 사용하는 <code>"name"</code>이 있습니다. 기본 값은 <code>"symbol"</code>입니다.</dd>
+ <dt><code>useGrouping</code></dt>
+ <dd>천 단위 구분자 혹은 천/라크/크로르 단위 구분자의 삽입 여부. 가능한 값은 <code>true</code>와 <code>false</code>입니다. 기본 값은 <code>true</code>입니다.</dd>
+ </dl>
+
+ <p>아래 속성은 두 가지 그룹으로 나뉩니다. <code>minimumIntegerDigits</code>, <code>minimumFractionDigits</code>, <code>maximumFractionDigits</code>가 첫 번째 그룹이고, <code>minimumSignificantDigits</code>와 <code>maximumSignificantDigits</code>가 두 번째 그룹으로, 두 번째 그룹 중 하나라도 지정하면 첫 번째 그룹은 모두 무시합니다.</p>
+
+ <dl>
+ <dt><code>minimumIntegerDigits</code></dt>
+ <dd>정수부의 최소 자릿수. 가능한 값은 1부터 21까지의 수로, 기본값은 1입니다.</dd>
+ <dt><code>minimumFractionDigits</code></dt>
+ <dd>소수부의 최소 자릿수. 가능한 값은 0부터 20까지의 수로, 평문 숫자와 백분율 서식의 기본값은 0입니다. 통화 서식의 기본값은 <a href="http://www.currency-iso.org/en/home/tables/table-a1.html">ISO 4217 통화 코드 목록</a>이 제공하는 보조 단위의 자릿수에 따라 다릅니다. (목록에 정보가 없을 경우 2)</dd>
+ <dt><code>maximumFractionDigits</code></dt>
+ <dd>소수부의 최대 자릿수. 가능한 값은 0부터 20까지의 수로, 평문 숫자 서식의 기본값은 <code>minimumFractionDigits</code>와 3 중 더 큰 값입니다. 통화 서식의 기본값은 <code>minimumFractionDigits</code>와, <a href="http://www.currency-iso.org/en/home/tables/table-a1.html">ISO 4217 통화 코드 목록</a>이 제공하는 보조 단위의 자릿수(목록에 정보가 없을 경우 2) 중 더 큰 값입니다. 백분율 서식의 기본값은 <code>minimumFractionDigits</code>와 0 중 더 큰 값입니다.</dd>
+ <dt><code>minimumSignificantDigits</code></dt>
+ <dd>유효숫자의 최소 수. 가능한 값은 1부터 21까지의 수로, 기본값은 1입니다.</dd>
+ <dt><code>maximumSignificantDigits</code></dt>
+ <dd>유효숫자의 최대 수. 가능한 값은 1부터 21까지의 수로, 기본값은 21입니다.</dd>
+ </dl>
+ </dd>
+</dl>
+
+<h2 id="설명">설명</h2>
+
+<h3 id="속성">속성</h3>
+
+<dl>
+ <dt>{{jsxref("NumberFormat.prototype", "Intl.NumberFormat.prototype")}}</dt>
+ <dd>모든 인스턴스에 속성을 추가할 수 있습니다.</dd>
+</dl>
+
+<h3 id="메서드">메서드</h3>
+
+<dl>
+ <dt>{{jsxref("NumberFormat.supportedLocalesOf", "Intl.NumberFormat.supportedLocalesOf()")}}</dt>
+ <dd>주어진 로케일 목록 중, 런타임이 지원하는 항목을 배열로 반환합니다.</dd>
+</dl>
+
+<h2 id="NumberFormat_인스턴스"><code>NumberFormat</code> 인스턴스</h2>
+
+<h3 id="속성_2">속성</h3>
+
+<p><code>NumberFormat</code> 인스턴스는 프로토타입의 다음 속성을 상속합니다.</p>
+
+<div>{{page('/ko/docs/Web/JavaScript/Reference/Global_Objects/NumberFormat/prototype', '속성')}}</div>
+
+<h3 id="메서드_2">메서드</h3>
+
+<p><code>NumberFormat</code> 인스턴스는 프로토타입의 다음 메서드를 상속합니다.</p>
+
+<div>{{page('/ko/docs/Web/JavaScript/Reference/Global_Objects/NumberFormat/prototype', '메서드')}}</div>
+
+<h2 id="예제">예제</h2>
+
+<h3 id="기본적인_사용_방법">기본적인 사용 방법</h3>
+
+<p>로케일을 지정하지 않고 사용하면 기본 로케일 및 기본 옵션 서식을 적용한 문자열을 반환합니다.</p>
+
+<pre class="brush: js">var number = 3500;
+
+console.log(new Intl.NumberFormat().format(number));
+// → 한국 로케일의 경우 '3,500' 표시
+</pre>
+
+<h3 id="locales_사용하기"><code>locales</code> 사용하기</h3>
+
+<p>다음 예제는 지역화된 숫자 서식의 예시를 보입니다. 어플리케이션의 사용자 인터페이스 언어에 맞는 서식을 적용하려면 <code>locales</code> 매개변수로 적절한 언어(와, 필요한 경우 대체 언어)를 제공하는걸 잊지 마세요.</p>
+
+<pre class="brush: js">var number = 123456.789;
+
+// 독일은 소수점 구분자로 쉼표를 사용하고 천 단위 구분자로 마침표를 사용
+console.log(new Intl.NumberFormat('de-DE').format(number));
+// → 123.456,789
+
+// 대부분의 아랍어 사용 국가에서는 실제 아라비아 숫자를 사용
+console.log(new Intl.NumberFormat('ar-EG').format(number));
+// → ١٢٣٤٥٦٫٧٨٩
+
+// 인도는 천, 라크(십만), 크로르(천만) 단위에 구분자 사용
+console.log(new Intl.NumberFormat('en-IN').format(number));
+// → 1,23,456.789
+
+// nu 확장 키로 기수법 지정 (아래 예시는 중국식 숫자 표기)
+console.log(new Intl.NumberFormat('zh-Hans-CN-u-nu-hanidec').format(number));
+// → 一二三,四五六.七八九
+
+// 발리어와 같이 지원되지 않을 수도 있는 언어를 지정할 때는
+// 다음과 같이 대체 언어를 지정할 수 있음. 아래의 경우 대체 언어는 인도어
+console.log(new Intl.NumberFormat(['ban', 'id']).format(number));
+// → 123.456,789
+</pre>
+
+<h3 id="options_사용"><code>options</code> 사용</h3>
+
+<p><code>options</code> 매개변수를 지정해 결과를 원하는 형태로 바꿀 수 있습니다.</p>
+
+<pre class="brush: js">var number = 123456.789;
+
+// 통화 서식
+console.log(new Intl.NumberFormat('de-DE', { style: 'currency', currency: 'EUR' }).format(number));
+// → 123.456,79 €
+
+// 한국 원화는 보조 통화 단위를 사용하지 않음
+console.log(new Intl.NumberFormat('ko-KR', { style: 'currency', currency: 'KRW' }).format(number));
+// → ₩123,457
+
+// 유효숫자를 세 개로 제한
+console.log(new Intl.NumberFormat('en-IN', { maximumSignificantDigits: 3 }).format(number));
+// → 1,23,000
+</pre>
+
+<h2 id="명세">명세</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">명세</th>
+ <th scope="col">상태</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES Int 1.0', '#sec-11.1', 'Intl.NumberFormat')}}</td>
+ <td>{{Spec2('ES Int 1.0')}}</td>
+ <td>초기 정의.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES Int 2.0', '#sec-11.1', 'Intl.NumberFormat')}}</td>
+ <td>{{Spec2('ES Int 2.0')}}</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES Int Draft', '#numberformat-objects', 'Intl.NumberFormat')}}</td>
+ <td>{{Spec2('ES Int Draft')}}</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="브라우저_호환성">브라우저 호환성</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.builtins.Intl.NumberFormat")}}</p>
+</div>
+
+<h2 id="같이_보기">같이 보기</h2>
+
+<div>{{page('/ko/docs/Web/JavaScript/Reference/Global_Objects/Intl', '같이_보기')}}</div>
diff --git a/files/ko/web/javascript/reference/global_objects/intl/numberformat/prototype/index.html b/files/ko/web/javascript/reference/global_objects/intl/numberformat/prototype/index.html
new file mode 100644
index 0000000000..19b0b8e0e6
--- /dev/null
+++ b/files/ko/web/javascript/reference/global_objects/intl/numberformat/prototype/index.html
@@ -0,0 +1,85 @@
+---
+title: Intl.NumberFormat.prototype
+slug: Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/prototype
+tags:
+ - Internationalization
+ - Intl
+ - JavaScript
+ - NumberFormat
+ - Property
+ - Prototype
+translation_of: Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat
+---
+<div>{{JSRef}}</div>
+
+<p><strong><code>Intl.NumberFormat.prototype</code></strong> 속성은 {{jsxref("NumberFormat", "Intl.NumberFormat")}} 생성자의 프로토타입을 나타냅니다.</p>
+
+<div>{{js_property_attributes(0, 0, 0)}}</div>
+
+<h2 id="설명">설명</h2>
+
+<p><code>Intl.NumberFormat</code> 인스턴스에 대한 설명은 {{jsxref("NumberFormat")}} 문서를 참고하세요.</p>
+
+<p>{{jsxref("NumberFormat", "Intl.NumberFormat")}} 인스턴스는 <code>Intl.NumberFormat.prototype</code>을 상속합니다. 프로토타입 객체를 변형하면 모든 {{jsxref("NumberFormat", "Intl.NumberFormat")}} 인스턴스가 영향을 받습니다.</p>
+
+<h2 id="속성">속성</h2>
+
+<dl>
+ <dt><code>Intl.NumberFormat.prototype.constructor</code></dt>
+ <dd><code>Intl.NumberFormat</code>에 대한 참조입니다.</dd>
+</dl>
+
+<h2 id="메서드">메서드</h2>
+
+<dl>
+ <dt>{{jsxref("NumberFormat.format", "Intl.NumberFormat.prototype.format()")}}</dt>
+ <dd>주어진 숫자에 {{jsxref("NumberFormat")}} 객체의 로케일과 서식 설정을 적용해 반환합니다.</dd>
+</dl>
+
+<dl>
+ <dt>{{jsxref("NumberFormat.formatToParts", "Intl.NumberFormat.prototype.formatToParts()")}}</dt>
+ <dd>서식을 적용한 숫자의 각 부분을 객체로 표현해서 {{jsxref("Array")}}로 반환합니다. 반환 값은 로케일별 커스텀 서식에 사용할 수 있습니다.</dd>
+ <dt>{{jsxref("NumberFormat.resolvedOptions", "Intl.NumberFormat.prototype.resolvedOptions()")}}</dt>
+ <dd>객체 인스턴스 생성 때 주어진 로케일과 콜레이션 설정이 어떻게 반영되었나 나타내는 새로운 객체를 반환합니다.</dd>
+</dl>
+
+<h2 id="명세">명세</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>{{SpecName('ES Int 1.0', '#sec-11.2.1', 'Intl.NumberFormat.prototype')}}</td>
+ <td>{{Spec2('ES Int 1.0')}}</td>
+ <td>Initial definition.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES Int 2.0', '#sec-11.2.1', 'Intl.NumberFormat.prototype')}}</td>
+ <td>{{Spec2('ES Int 2.0')}}</td>
+ <td></td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES Int Draft', '#sec-Intl.NumberFormat.prototype', 'Intl.NumberFormat.prototype')}}</td>
+ <td>{{Spec2('ES Int Draft')}}</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="브라우저_호환성">브라우저 호환성</h2>
+
+<div>
+
+
+<p>{{Compat("javascript.builtins.Intl.NumberFormat.prototype")}}</p>
+</div>
+
+<h2 id="같이_보기">같이 보기</h2>
+
+<ul>
+ <li>{{jsxref("NumberFormat", "Intl.NumberFormat")}}</li>
+</ul>