ECMAScript 2027 국제화 API 명세서 (ECMA-402 14번째 판)는 ECMA-262를 보완하는 주요 언어 민감 기능을 제공합니다. 이 기능들은 유니코드 국제화 컴포넌트(ICU) 라이브러리 (https://unicode-org.github.io/icu-docs/), .NET 프레임워크, Java 플랫폼
등 잘 알려진 국제화 API에서 선택되었습니다.
1번째 판 API는 Nebojša Ćirić와 Jungshik Shin의 제안에 기반하여 2010년 9월 Ecma TC39가 설립한 임시 그룹에 의해 개발되었습니다.
2번째 판 API는 2015년 6월 총회에서 ECMAScript 6번째 판을 보완하는 것으로 채택되었습니다.
3번째 판 API는 Ecma TC39의 새로운 연간 릴리즈 주기와 오픈 개발 프로세스 하에 처음으로 출시되었습니다. ECMA-402 소스 문서에서 평문 소스 문서가 구축되어
GitHub에서 완전히 개발의 기반이 되었습니다. 이 표준의 개발 기간 동안 수십 건의 풀 리퀘스트와 이슈가 제출되어 여러 버그 수정, 편집 수정 및 기타 개선 사항이 반영되었습니다. 또한 Ecmarkup,
Ecmarkdown, Grammarkdown 등 다양한 소프트웨어 도구가 개발되어 이 작업을 지원했습니다.
수많은 조직을 대표하는 수십 명의 개인이 Ecma TC39 내에서 이 판과 이전 판의 개발에 매우 중요한 기여를 했습니다. 또한 TC39의 ECMAScript 활동을 지원하는 활발한 커뮤니티가
형성되었습니다. 이 커뮤니티는 수많은 초안 검토, 버그 리포트 제출, 구현 실험, 테스트 스위트 기여, ECMAScript 국제화에 대한 전 세계 개발자 커뮤니티 교육을 수행했습니다. 불행히도 이 작업에
기여한 모든 사람과 조직을 식별하고 인정하는 것은 불가능합니다.
Norbert Lindenberg
ECMA-402, 1번째 판 프로젝트 에디터
Rick Waldron
ECMA-402, 2번째 판 프로젝트 에디터
Caridy Patiño
ECMA-402, 3번째, 4번째, 5번째 판 프로젝트 에디터
Caridy Patiño, Daniel Ehrenberg, Leo Balter
ECMA-402, 6번째 판 프로젝트 에디터
Leo Balter, Valerie Young, Isaac Durazo
ECMA-402, 7번째 판 프로젝트 에디터
Leo Balter, Richard Gibson
ECMA-402, 8번째 판 프로젝트 에디터
Leo Balter, Richard Gibson, Ujjwal Sharma
ECMA-402, 9번째 판 프로젝트 에디터
Richard Gibson, Ujjwal Sharma
ECMA-402, 10번째 판 프로젝트 에디터
Richard Gibson, Ujjwal Sharma
ECMA-402, 11번째 판 프로젝트 에디터
Ben Allen, Richard Gibson, Ujjwal Sharma
ECMA-402, 12번째 판 프로젝트 에디터
Ben Allen, Richard Gibson, Ujjwal Sharma
ECMA-402, 13번째 판 프로젝트 에디터
Ben Allen, Richard Gibson, Ujjwal Sharma
ECMA-402, 14번째 판 프로젝트 에디터
1 범위
이 표준은 다양한 인간 언어와 국가에서 사용되는 언어적 및 문화적 관습에 맞게 프로그램을 조정해야 하는 ECMAScript 객체를 위한 응용 프로그램 프로그래밍 인터페이스를 정의합니다.
2 적합성
이 명세의 적합한 구현은 ECMA-262를 준수해야 하며, 이 명세에서 설명된 모든 객체, 속성, 함수 및 프로그램 의미론을 제공하고 지원해야 합니다. 이 명세의 어떤 내용도 ECMA-262에서 금지된
동작을 허용하도록 의도된 것이 아니며, 그러한 충돌은 ECMA-262의 제약을 무시하는 것이 아니라 편집상의 오류로 간주해야 합니다.
적합한 구현은 이 명세에서 설명된 것 외에도 추가적인 객체, 속성, 함수 등을 제공할 수 있습니다. 특히, 적합한 구현은 이 명세에서 설명되지 않은 속성 및 해당 속성의 값을, 여기서 설명된 객체에 대해
제공할 수 있습니다. 적합한 구현은 이 명세에서 정의된 함수에 선택적 인수를 추가하는 것은 허용되지 않습니다.
적합한 구현은 다음 options 인수의 속성에 대해 추가 값을 허용하고, RangeError를 발생시키는 대신 구현 정의 동작을 할 수 있습니다:
모든 생성자와 supportedLocalesOf 메서드에서 options 속성 "localeMatcher".
Collator 생성자에서 options 속성 "usage" 및 "sensitivity".
NumberFormat 생성자에서 options 속성 "minimumIntegerDigits", "minimumFractionDigits", "maximumFractionDigits",
"minimumSignificantDigits", "maximumSignificantDigits", 추가 값이 지정된 제한보다 더 큰 정수 값으로 해석되는 경우.
PluralRules 생성자에서 options 속성 "minimumIntegerDigits", "minimumFractionDigits", "maximumFractionDigits",
"minimumSignificantDigits", 추가 값이 지정된 제한보다 더 큰 정수 값으로 해석되는 경우.
PluralRules 생성자에서 options 속성 "type".
RelativeTimeFormat 생성자에서 options 속성 "style" 및 "numeric".
DisplayNames 생성자에서 options 속성 "style" 및 "type".
3 규범적 참고문헌
다음에 참조된 문서는 이 문서의 적용에 필요합니다. 날짜가 명시된 참고문헌의 경우, 인용된 판만 적용됩니다. 날짜가 명시되지 않은 참고문헌의 경우, 참조된 문서의 최신 판(모든 개정 포함)이 적용됩니다.
이 명세의 섹션들은 이러한 참고문헌에 의존하며, 최신 표준과 일치하도록 최선을 다해 업데이트되지만, 항상 최신 상태를 보장하지는 않습니다.
4 개요
이 섹션은 비규범적입니다.
4.1 국제화, 지역화, 그리고 세계화
소프트웨어의 국제화란 다양한 언어를 사용하는 사용자와 서로 다른 문화적 기대를 가진 사용자의 요구를 지원하거나 쉽게 적응할 수 있도록 설계하는 것을 의미하며, 전 세계 사용자 간의 소통을 가능하게
합니다. 지역화는 특정 언어와 문화에 실제로 적응하는 과정입니다. 소프트웨어의 세계화는 일반적으로 국제화와 지역화의 결합으로 이해됩니다. 세계화는 모든 언어를 지원하는 텍스트 표현을 사용하고, 언어,
국가, 시간대 및 기타 관련 매개변수를 식별하기 위해 표준 식별자를 사용하는 가장 낮은 수준에서 시작합니다. 이후 사용자가 이해할 수 있는 사용자 인터페이스 언어와 데이터 표현을 사용하며, 마지막으로
제품별로 사용자의 언어, 문화, 환경에 맞춘 적응이 필요할 수 있습니다.
ECMA-262는 텍스트 표현에 유니코드를 사용하고 몇 가지 언어 민감 함수들을 제공함으로써 기반을 마련하지만, 이러한 함수들의 동작을 애플리케이션이 제어할 수 있는 방법은 거의 제공하지 않습니다. 이
명세는 커스터마이즈 가능한 언어 민감 기능을 제공함으로써 그 기반 위에 구축됩니다. 이 API는 국제화되지 않은 애플리케이션에도 유용하며, 단일 언어와 지역만을 대상으로 하는 애플리케이션도 해당 언어와
지역을 제대로 지원해야 하기 때문입니다. 또한, 이 API는 여러 언어와 지역을 동시에 지원해야 하는 서버 환경 등에서 필요한 애플리케이션도 지원할 수 있습니다.
4.2 API 개요
이 명세는 ECMA-262를 보완하기 위해 주요 언어 민감 기능을 제공하도록 설계되었으며, 전체 또는 일부를 구현에 추가할 수 있습니다. 이 명세는 ECMAScript 코드에서 관찰 가능한 새로운 언어
값(예: [[FallbackSymbol]] 내부 슬롯의 값 및 %Intl%에서 프로퍼티 접근을 통해 전이적으로
도달 가능한 값의 집합)을 도입하며, ECMA-262에서 명세된 일부 함수의 정의도 정제합니다(아래에서 설명). 두 범주 모두 ECMA-262에서 정의된 값과 인터페이스에 대해 허용된 동작을 금지하지
않으므로, 이 명세를 모든 구현에서 채택할 수 있도록 지원합니다.
이 명세는 대부분의 애플리케이션에서 필요한 여러 주요 언어 민감 기능을 제공합니다: 로케일 선택 및 검사, 문자열 비교(정렬) 및 대소문자 변환, 복수 규칙, 텍스트 분할, 숫자, 절대 및 상대 날짜와
시간, 기간, 리스트의 포매팅. ECMA-262는 이러한 기본 기능에 대한 함수를 제공합니다(Array.prototype에서: toLocaleString; String.prototype에서: localeCompare, toLocaleLowerCase,
toLocaleUpperCase; Number.prototype에서: toLocaleString;
Date.prototype에서: toLocaleString, toLocaleDateString,
toLocaleTimeString), 하지만 실제 동작은 대부분 구현 정의입니다. 이 명세는 추가 기능, 언어 및 동작 세부사항에 대한 제어, 그리고 요구되는 기능에 대한 더 완전한 명세를 제공합니다.
애플리케이션은 API를 두 가지 방식으로 사용할 수 있습니다:
서비스 생성자를 직접 사용하여 객체를 생성하고, 선호하는 언어 목록과 동작을 구성할 옵션을 지정합니다. 객체는 주요 함수(compare, select, format 등)를 제공하며,
반복적으로 호출할 수 있습니다. 또한, 애플리케이션이 객체의 정확한 구성 정보를 확인할 수 있도록 resolvedOptions 함수를 제공합니다.
위에서 언급한 ECMA-262의 함수들을 간접적으로 사용합니다. 정렬 및 포매팅 함수는 이 명세에서 Collator, NumberFormat, DateTimeFormat 생성자와 동일한 인자를 받아
compare 또는 format 메서드와 동일한 결과를 생성하도록 재정의됩니다. 대소문자 변환 함수는 선호하는 언어 목록을 받아들이도록 재정의됩니다.
ECMA 402 v1에서는 Intl 생성자가 기존 객체를 수신자로 받아 호출될 때 관련 내부 슬롯을 추가하여 해당 객체를 클래스의 인스턴스로 변환하는 동작을 지원했습니다. ECMA 402 v2에서는 기존
객체에 내부 슬롯을 추가하지 않도록 이 기능이 제거되었습니다. ECMA 402 v3에서는 생성자가 호출될 때 모든 객체에 기본 Intl 인스턴스를 체인하는 "규범적 선택적" 모드로 이 기능이 다시
추가되었습니다. 자세한 내용은 이슈 57을 참고하세요.
4.4 구현 종속성
국제화의 특성상, 이 명세는 여러 세부사항을 구현 종속적으로 남겨둬야 합니다:
구현이 충분한 지역화로 지원하는 로케일의 집합: 언어학자들은 수천 개의 인간 언어를 기술했으며, IANA 언어 서브태그 레지스트리에는 로케일 식별자의 기반이 되는 7000개 이상의 주요
언어 서브태그가 포함되어 있습니다. Common Locale Data Repository와 같은 대규모 로케일 데이터 컬렉션도 모든 언어와 그 지역 또는 방언 변형의 극히 일부만을 다룹니다. 리소스가
제한된 장치를 대상으로 하는 구현은 이 집합을 더욱 줄여야 할 수도 있습니다.
포매트 패턴과 같은 지역화의 정확한 형태: 많은 경우 로케일에 따라 달라지는 관습이 표준화되어 있지 않아 여러 형태가 공존하거나 시간이 지나면서 변화합니다. 다양한 국제화 라이브러리들이
서로 다른 형태를 구현했을 수 있으며, 그 중 어느 것도 실제로 잘못된 것은 아닙니다. 이 API가 기존 라이브러리 위에 구현될 수 있도록 이러한 변형을 허용해야 합니다.
유니코드의 부분집합: 정렬과 같은 일부 연산은 전체 유니코드 문자 집합의 문자를 포함하는 문자열에 대해 동작합니다. 그러나 유니코드 표준과 ECMAScript 표준 모두 구현이 유니코드
문자 집합의 부분집합으로 기능을 제한할 수 있도록 허용합니다. 또한, 로케일 관습은 일반적으로 전체 유니코드 문자 집합에 대한 동작을 지정하지 않고, 해당 로케일에 관련된 문자에 대해서만 지정합니다.
유니코드 정렬 알고리즘은 전체 유니코드 문자 집합에 대한 기본 정렬 순서와 로컬 관습에 맞춘 맞춤 기능을 결합하지만, 부분집합과 맞춤은 여전히 동작의 차이를 초래합니다.
브라우저 구현에서는 특정 오리진에 대해 보이는 로케일, 통화, 달력, 숫자 시스템 및 기타 열거 가능한 항목의 초기 집합이 동일한 사용자 에이전트 문자열(엔진 및 플랫폼 버전)을 공유하는 모든 사용자에게
동일해야 합니다. 또한, 이러한 집합의 동적 변경은 사용자가 서로 구별될 수 있도록 해서는 안 됩니다. 이 제약은 국제화에 내재된 지문 채취 위험을 줄이기 위해 부과되었으며, 향후 개정에서 완화될 수
있습니다. 이 제약의 결과로, 브라우저 구현이 온디맨드 로케일 설치를 허용하고 특정 오리진에서 새로운 로케일 설치가 필요할 수 있는 요청을 처음 받을 때, 해당 로케일이 이미 설치되어 있는지 여부를
공개해서는 안 됩니다.
이 명세 전체에서 구현 및 로케일 종속 동작은 ILD로, 구현, 로케일, 숫자 시스템 종속 동작은 ILND로 지칭합니다.
4.4.1 구현 간 호환성
ECMA 402는 함수에서 사용하는 데이터의 스키마를 기술합니다.
내부 데이터는 구현 종속적이며, 시간이 지남에 따라 변경되고 구현마다 다를 수 있습니다.
이러한 변형은 프로그래머에게 보이며, 특정 출력에 의존하는 프로그램을 작성할 수도 있습니다.
그러나 이 명세는 잘 작성된 프로그램이 구현 간에 동작할 수 있도록 합리적인 제약을 기술하려고 합니다.
구현은 언어 데이터의 조화를 계속 노력해야 합니다.
ECMA-262에서 설명한 바와 같이, 알고리즘은 ECMAScript 구성 요소의 요구되는 의미를 정확하게 명세하기 위해 사용되지만, 특정 구현 기술의 사용을 암시하는 것은 아닙니다. 내부 슬롯은 객체 값의
의미를 정의하기 위해 사용되지만 API의 일부가 아닙니다. 순전히 설명 목적으로 정의됩니다. API 구현은 내부 슬롯을 여기서 설명한 방식대로 생성하고 동작하는 것처럼 동작해야 합니다.
Record 명세 타입의 확장으로, “[[<name>]]” 표기는 변수 name이 String 값이어야 하며, 그 이름이 주어진 필드를 나타냅니다. 예를 들어, 변수 s가 "a" 값을
갖는 경우 [[<s>]]는 필드 [[a]]를 나타냅니다.
이 명세는 Normative Optional로 구분된 블록을 사용하여 ECMA 262의 Annex B의 의미를 나타냅니다. 즉,
normative optional 섹션은 ECMAScript 호스트가 웹 브라우저일 때 필수입니다. 섹션의 내용은 규범적이지만 ECMAScript 호스트가 웹 브라우저가 아닌 경우 선택적입니다.
6 Locale, Currency, Time Zone, Measurement Unit, Numbering System, Collation 및 Calendar의 식별
이 절은 이 명세에서 locale, currency, time zone, measurement unit, numbering system, collation, calendar 및 pattern string을 식별하는 데 사용되는 String 값을 설명한다.
6.1 대소문자 구분 및 대소문자 매핑
locale, currency, script 및 time zone을 식별하는 데 사용되는 String 값은 ASCII-case-insensitive 방식으로 해석되며, code unit 0x0041부터 0x005A까지(Unicode 문자 LATIN CAPITAL LETTER A부터 LATIN CAPITAL LETTER Z까지에 대응)를 대응하는 code unit 0x0061부터 0x007A까지(Unicode 문자 LATIN SMALL LETTER A부터 LATIN SMALL LETTER Z까지에 대응)와 동등하게 취급한다. 두 범위 모두 양끝을 포함한다. 다른 case folding 동등성은 적용되지 않는다.
Note
예를 들어, "ß" (U+00DF)는 "SS" (U+0053, U+0053)와 일치하거나 매핑되어서는 안 된다. "ı" (U+0131)는 "I" (U+0049)와 일치하거나 매핑되어서는 안 된다.
String 값 string의 ASCII-uppercase는 string에서 ASCII lowercase letter code unit(0x0061부터 0x007A까지, 양끝 포함)이 나타날 때마다 대응하는 ASCII uppercase letter code unit(0x0041부터 0x005A까지, 양끝 포함)으로 대체하고, 다른 모든 code unit은 보존하여 string으로부터 도출된 String 값이다.
String 값 string의 ASCII-lowercase는 string에서 ASCII uppercase letter code unit(0x0041부터 0x005A까지, 양끝 포함)이 나타날 때마다 대응하는 ASCII lowercase letter code unit(0x0061부터 0x007A까지, 양끝 포함)으로 대체하고, 다른 모든 code unit은 보존하여 string으로부터 도출된 String 값이다.
String 값 A의 ASCII-uppercase가 B의 ASCII-uppercase와 정확히 같은 code unit 시퀀스이면, String 값 A는 String 값 B에 대한 ASCII-case-insensitive match이다. Unicode code point 시퀀스 A는 B가 CodePointsToString(A)에 대한 ASCII-case-insensitive match이면 B에 대한 ASCII-case-insensitive match이다.
Locale identifier는 "-" (U+002D HYPHEN-MINUS) 문자로 구분되는 case-insensitive Unicode Basic Latin 영숫자 subtag로 구성되며, 단일 문자 subtag는 "singleton subtag"라고 한다.
Unicode Technical Standard #35 Part 1 Core, Section 3.6 Unicode BCP 47 U Extensionsubtag 시퀀스가 광범위하게 사용되며, "Unicode locale extension sequence"라는 용어는 unicode_locale_extensions Unicode locale nonterminal에 의해 매칭될 수 있고 "-x-…" private use subtag sequence의 일부가 아닌 language tag의 가장 긴 substring을 설명한다. 이는 "-u-"로 시작하며, 바로 뒤따르는 singleton subtag가 아닌 모든 subtag와 그 앞의 "-" separator를 포함한다. 예를 들어, "en-US-u-fw-mon-x-u-ex-foobar"의 Unicode locale extension sequence는 "-u-fw-mon"이다.
모든 well-formed language tag는 이 명세가 정의하는 API와 함께 사용하기에 적절하지만, 구현은 이를 검증하기 위해 Unicode Common Locale Data Repository(CLDR) 데이터를 사용할 필요는 없다. 구현이 충분한 localization과 함께 지원하는 locale 및 따라서 language tag의 집합은 구현 정의이다. Intl 생성자는 요청된 language tag를 각 구현에서 지원하는 locale로 매핑한다.
6.2.1 IsWellFormedLanguageTag ( locale )
The abstract operation IsWellFormedLanguageTag takes argument locale (String) and returns Boolean. locale이 unicode_bcp47_locale_id의 well-formedness 제약을 따르는 well-formed language tag인지 여부를 결정한다. 이는 locale이 의미 있는 semantics를 전달하는지 여부를 고려하지 않으며, aliased subtag와 그 preferred replacement subtag를 구분하지 않고, canonical casing이나 subtag ordering을 요구하지도 않는다. It performs the following steps when called:
The abstract operation CanonicalizeUnicodeLocaleId takes argument locale (language tag) and returns Unicode canonicalized locale identifier. locale의 canonical하고 case-regularized된 형식을 반환한다. It performs the following steps when called:
반환된 값은 potential fingerprinting vector이다. browser environment에서는 추가적인 distinguishing information을 제공하지 않도록 navigator.language와 일치해야 한다.
6.3 Currency Code
이 명세는 ISO 4217에 정의된 3-letter currency code를 사용하여 currency를 식별한다. 그 canonical form은 uppercase이다.
모든 well-formed 3-letter ISO 4217 currency code가 허용된다. 그러나 localized currency symbol을 사용할 수 있는 currency code와 language tag의 조합 집합은 구현 의존이다. localized currency symbol을 사용할 수 없는 경우 ISO 4217 currency code가 형식화에 사용된다.
6.3.1 IsWellFormedCurrencyCode ( currency )
The abstract operation IsWellFormedCurrencyCode takes argument currency (String) and returns Boolean. currency 인수가 well-formed 3-letter ISO 4217 currency code를 나타내는지 검증한다. It performs the following steps when called:
normalized가 0x0041부터 0x005A까지(Unicode 문자 LATIN CAPITAL LETTER A부터 LATIN CAPITAL LETTER Z까지에 대응) 밖의 code unit을 포함하면 false를 반환한다.
true를 반환한다.
6.4 AvailableCanonicalCurrencies ( )
The implementation-defined abstract operation AvailableCanonicalCurrencies takes no arguments and returns String의 List. 반환된 List는 lexicographic code unit order에 따라 정렬되며, Intl.DisplayNames 및 Intl.NumberFormat 객체의 기능을 구현이 제공하는 currency를 식별하는 고유하고, well-formed이며, uppercase canonicalized된 3-letter ISO 4217 currency code를 포함한다.
역사적인 이유로, "UTC"는 primary time zone identifier여야 한다.
"Etc/UTC", "Etc/GMT" 및 "GMT", 그리고 그중 하나로 resolve되는 모든 Link name은 "UTC"로 resolve되는 non-primary time identifier여야 한다.
zone.tab 파일의 “TZ” 열에 나열되지 않고, 하나의 ISO 3166-1 Alpha-2 country code의 territory 안에 완전히 포함된 geographical area를 나타내는 모든 Link name은 같은 country code의 territory 안에 완전히 포함된 geographical area를 나타내는 primary identifier로 resolve되어야 한다.
예를 들어, "Atlantic/Jan_Mayen"은 "Arctic/Longyearbyen"으로 resolve되어야 한다.
Note
IANA Time Zone Database는 어떤 available named time zone identifier가 primary인지에 영향을 주는 build option을 제공한다.
기본 build option은 서로 다른 country의 time zone을 merge한다. 예를 들어 "Atlantic/Reykjavik"은 Zone "Africa/Abidjan"에 대한 Link로 build된다.
지리적으로나 정치적으로 구별되는 location은 IANA Time Zone Database의 향후 버전에서 divergent time zone rule을 도입할 가능성이 있다.
위의 예외는 이러한 future-compatibility issue를 완화하는 역할을 한다.
Unicode Common Locale Data Repository(CLDR)는 어떤 available named time zone identifier가 primary 또는 non-primary인지 결정할 때 위 예외의 대부분을 구현한다.
구현 간 일관성을 위해 CLDR 데이터의 사용이 권장되지만, 필수는 아니다.
CLDR 기반이 아닌 구현도 timezone.xml의 CLDR identifier 데이터를 사용할 수 있다.
구현은 IANA Time Zone Database를 직접 build할 수도 있다. 예를 들어 PACKRATDATA=backzone PACKRATLIST=zone.tab와 같은 build option을 사용하고, 위 요구사항을 준수하기 위해 필요한 post-processing을 수행할 수 있다.
IANA Time Zone Database는 일반적으로 1년에 5회에서 10회 사이로 업데이트된다.
이러한 업데이트는 새 Zone 또는 Link name을 추가할 수 있고, Zone을 Link로 변경할 수 있으며, 임의의 Zone과 연결된 UTC offset 및 transition을 변경할 수 있다.
구현은 IANA Time Zone Database 업데이트를 가능한 한 빨리 포함하는 것이 권장된다.
그러한 신속한 조치는 ECMAScript 프로그램이 time-zone-sensitive 계산을 정확히 수행하고, 외부 입력 또는 host environment가 제공하는 새로 추가된 available named time zone identifier를 사용할 수 있도록 보장한다.
IANA Time Zone Database 유지관리자는 안정성을 위해 노력하지만, 드문 경우(평균적으로 1년에 한 번 미만) Zone이 새 Zone으로 대체될 수 있다.
예를 들어, 2022년에 "Europe/Kiev"는 새 "Europe/Kyiv" Zone으로 resolve되는 Link로 deprecated되었다.
deprecated Link를 renamed time zone identifier라고 하며, 새로 추가된 Zone을 replacement time zone identifier라고 한다.
이러한 드문 변경으로 인한 disruption을 줄이기 위해, 구현은 각 replacement time zone identifier를 처음에는 기존 renamed time zone identifier로 resolve되는 non-primary time zone identifier로 추가해야 한다.
이는 ECMAScript 프로그램이 두 identifier를 모두 인식할 수 있게 하지만, ECMAScript 프로그램이 아직 이를 인식하지 못하는 다른 시스템으로 replacement time zone identifier를 보낼 가능성도 줄인다.
rename waiting period가 지난 후, 구현은 새 Zone을 primary time zone identifier로 승격시키는 동시에 renamed time zone identifier를 non-primary로 강등해야 한다.
다른 시스템이 업데이트될 충분한 시간을 제공하기 위해, 권장되는 rename waiting period는 2년이다.
그러나 이는 정확하거나 dynamic할 필요는 없다.
대신 구현은 time zone data를 업데이트하는 일반적인 release process의 일부로 waiting period 후 replacement time zone identifier를 primary로 만들어야 한다.
waiting period는 새 Zone이 기존 Zone을 대체하기 위해 추가된 경우에만 적용되어야 한다.
기존 Zone과 Link가 swap된 경우에는 renaming이 발생하지 않았으므로 waiting period가 필요하지 않다.
Assert: result는 utcRecord.[[Identifier]]가 "UTC"이고 utcRecord.[[PrimaryIdentifier]]가 "UTC"인 Time Zone Identifier RecordutcRecord를 포함한다.
result를 반환한다.
Note 1
위 알고리즘은 Link를 primary time zone identifier로 resolve하기 위한 것으로, International Components for Unicode(ICU)의 icu::TimeZone::getIanaID() 동작 및 Unicode Common Locale Data Repository(CLDR)의 time zone identifier data 유지관리 process에 대응하도록 의도되었다.
이 알고리즘은 IANA Time Zone Database의 zone.tab 및 backzone 파일의 데이터를 사용하여 ISO 3166-1 Alpha-2 country code의 boundary를 넘지 않고 Link를 primary time zone identifier로 resolve한다.
Link의 country code가 zone.tab에 한 줄만 있으면, 그 줄이 primary time zone identifier를 결정한다.
그러나 그 country code가 zone.tab에 여러 줄을 가지면, backzone의 historical mapping을 사용해 올바른 primary time zone identifier를 식별해야 한다.
예를 들어, IANA Time Zone Database의 기본 build option이 "Pacific/Truk"(country code "FM")를 "Pacific/Port_Moresby"(country code "PG")에 대한 Link로 식별하는 경우 이를 resolve하려면, zone.tab의 “country-code” 열에서 "FM"에 대응하는 줄을 확인해야 한다.
그러한 줄이 하나뿐이면, 그 줄의 “TZ” 열이 "Pacific/Truk"와 연결된 primary time zone identifier를 결정한다.
그러나 zone.tab에 여러 "FM" 줄이 있으면, backzone을 검사해야 하며 "Link Pacific/Chuuk Pacific/Truk"와 같은 줄은 "Pacific/Chuuk"를 primary time zone identifier로 사용하게 한다.
zone.tab은 mapping data의 preferred source임에 주의하라. backzone mapping은 드문 경우 ISO 3166-1 Alpha-2 country code의 boundary를 넘을 수 있기 때문이다.
예를 들어, "Atlantic/Jan_Mayen"(country code "SJ")은 backzone에서 "Europe/Oslo"(country code "NO")로 매핑된다.
IANA Time Zone Database의 2024a release 기준으로, "Atlantic/Jan_Mayen"이 이러한 일이 발생하는 유일한 경우이다.
The abstract operation AvailablePrimaryTimeZoneIdentifiers takes no arguments and returns String의 List. 반환된 List는 IANA Time Zone Database에서 지원되는 Zone 및 Link name의 정렬된 List이다. It performs the following steps when called:
The abstract operation StringSplitToList takes arguments string (String) and separator (String) and returns String의 List.
반환된 List는 separator를 포함하지 않지만 separator의 occurrence가 바로 앞 및/또는 바로 뒤에 있는 string의 서로소 substring을 모두 포함한다.
그러한 각 substring은 separator의 인접한 occurrence 사이, string의 맨 처음에 있는 separator 앞, 또는 string의 맨 끝에 있는 separator 뒤에서는 빈 String이 되지만, 그 외에는 비어 있지 않다.
It performs the following steps when called:
이 명세는 Unicode Technical Standard #35 Part 2 General, Section 6.2 Unit Identifiers에 정의된 core unit identifier(또는 동등하게 core unit ID)를 사용하여 measurement unit을 식별한다. 그 canonical form은 Unicode Basic Latin lowercase letter(U+0061 LATIN SMALL LETTER A부터 U+007A LATIN SMALL LETTER Z까지)만 포함하고, zero or more medial hyphen(U+002D HYPHEN-MINUS)을 포함하는 string이다.
제한된 core unit identifier 집합만 허용된다.
허용되지 않은 core unit identifier를 사용하려고 하면 RangeError가 발생한다.
The abstract operation IsWellFormedUnitIdentifier takes argument unitIdentifier (String) and returns Boolean. unitIdentifier 인수가 허용된 single unit이거나 두 허용된 single unit의 나눗셈으로 형성된 complex unit인 well-formed core unit identifier를 나타내는지 검증한다. It performs the following steps when called:
The abstract operation IsSanctionedSingleUnitIdentifier takes argument unitIdentifier (String) and returns Boolean. unitIdentifier 인수가 이 명세의 현재 버전에서 허용된 single unit identifier 중 하나인지 검증한다. 이는 Common Locale Data Repository release 38 unit validity data의 부분 집합이며, list는 시간이 지남에 따라 늘어날 수 있다. Unicode Technical Standard #35 Part 2 General, Section 6.2 Unit Identifiers에서 논의된 것처럼, single unit identifier는 다른 unit identifier의 곱셈 또는 나눗셈으로 구성되지 않은 core unit identifier이다. It performs the following steps when called:
The abstract operation AvailableCanonicalUnits takes no arguments and returns String의 List. 반환된 List는 lexicographic code unit order에 따라 정렬되며, 헤더 행을 제외하고 Table 2의 모든 행에 나열된 simple unit identifier의 고유 값으로 구성된다.
The implementation-defined abstract operation AvailableCanonicalNumberingSystems takes no arguments and returns String의 List. 반환된 List는 lexicographic code unit order에 따라 정렬되며, Intl.DateTimeFormat, Intl.NumberFormat 및 Intl.RelativeTimeFormat 객체의 기능을 구현이 제공하는 numbering system을 식별하는 고유한 canonical numbering systems identifier를 포함한다. 이 List는 헤더 행을 제외하고 Table 30의 모든 행의 Numbering System 값을 포함해야 한다.
6.8 Collation Type
이 명세는 Unicode Technical Standard #35 Part 5 Collation, Section 3.1 Collation Types에 정의된 collation type을 사용하여 collation을 식별한다. 그 canonical form은 Unicode Basic Latin lowercase letter(U+0061 LATIN SMALL LETTER A부터 U+007A LATIN SMALL LETTER Z까지)만 포함하고 zero or more medial hyphen(U+002D HYPHEN-MINUS)을 포함하는 string이다.
이 명세는 Unicode Technical Standard #35 Part 4 Dates, Section 2 Calendar Elements에 정의된 calendar type을 사용하여 calendar를 식별한다. 그 canonical form은 Unicode Basic Latin lowercase letter(U+0061 LATIN SMALL LETTER A부터 U+007A LATIN SMALL LETTER Z까지)만 포함하고 zero or more medial hyphen(U+002D HYPHEN-MINUS)을 포함하는 string이다.
6.9.1 AvailableCalendars ( )
The implementation-defined abstract operation AvailableCalendars takes no arguments and returns String의 List. 반환된 List는 lexicographic code unit order에 따라 정렬되며, Intl.DateTimeFormat 객체의 기능을 구현이 제공하는 calendar를 식별하는 canonical form(6.9)의 고유한 calendar type을 포함한다. 여기에는 그 alias도 포함된다(예: "islamicc"와 "islamic-civil"을 둘 다 포함하거나 둘 다 포함하지 않음). List는 "iso8601"을 포함해야 한다.
6.10 Pattern String Type
Pattern String은 "{key}" 형식의 substring을 0개 이상 포함하는 String 값이며, 여기서 key는 ASCII word character의 요소로만 구성된 임의의 non-empty sequence일 수 있다. 추상 pattern string의 syntax는 구현 세부사항이며 ECMA-402 사용자에게 노출되지 않는다.
서비스 생성자는 locales 및 options 인수가 나타내는 요청을 구현의 실제 기능과 조정하기 위해 공통 pattern을 사용한다. 그 공통 동작은 기능을 설명하는 내부 슬롯, 이 내부 슬롯을 사용하는 추상 연산, 그리고 아래에 정의된 특수 데이터 유형의 관점에서 여기 설명된다.
Resolution Option Descriptor는 [[Key]](string, 보통 [[RelevantExtensionKeys]]List의 요소)와 [[Property]](string) 필드를 가진 Record이며, 선택적으로 [[Type]](boolean 또는 string)과 [[Values]](empty 또는 ECMAScript 언어 값의 List) 중 하나 또는 둘 모두를 추가로 가질 수 있다. 이는 객체 생성 중 locale resolution과 관련된 options를 읽는 방법을 설명한다.
[[SortLocaleData]] 및 [[SearchLocaleData]](Intl.Collator용)와 [[LocaleData]](그 밖의 모든 service constructor용)는 Record이다. service constructor에 특정한 필드 외에도, 이러한 각 Record는 [[AvailableLocales]]에 포함된 각 locale에 대한 필드를 가진다. 그러한 각 locale 이름 필드의 값은 Record이며, 그 안에서 [[RelevantExtensionKeys]]의 각 요소는 해당 Unicode locale extension sequence key에 대해 관련 locale에서 구현이 지원하는 type value를 나타내는 비어 있지 않은 String List 값을 가진 필드의 이름을 식별하고, 첫 번째 요소는 그 locale에서 해당 key의 기본값을 제공한다.
Note
예를 들어, DateTimeFormat 구현은 [[AvailableLocales]] 내부 슬롯에 language tag"fa-IR"을 포함할 수 있으며, (11.2.3에 따라) [[RelevantExtensionKeys]] 내부 슬롯에 key "ca", "hc" 및 "nu"를 포함해야 한다.
그 locale의 기본 calendar는 보통 "persian"이지만, 구현은 "gregory", "islamic" 및 "islamic-civil"도 지원할 수 있다.
따라서 DateTimeFormat [[LocaleData]] 내부 슬롯의 Record는 값이 { [[ca]]: « "persian", "gregory", "islamic", "islamic-civil" », [[hc]]: « … », [[nu]]: « … » }와 같은 Record인 [[fa-IR]] 필드를 포함하고, 같은 값 형태를 가지지만 List의 요소가 다른 locale 이름 필드들도 함께 포함한다.
9.2 추상 연산
9.2.1 CanonicalizeLocaleList ( locales )
The abstract operation CanonicalizeLocaleList takes argument locales (ECMAScript 언어 값) and returns Language Priority List를 포함하는 정상 완료 또는 throw 완료. It performs the following steps when called:
The abstract operation UnicodeExtensionComponents takes argument extension (Unicode locale extension sequence) and returns [[Attributes]] 및 [[Keywords]] 필드를 가진 Record. extension을 고유한 attribute의 List와 고유한 key를 가진 keyword의 List로 분해한다. attribute 또는 keyword key가 처음 이후 반복해서 나타나는 경우는 무시된다. It performs the following steps when called:
e가 not-found이면 length를 size - k로 두고, 그렇지 않으면 length를 e - k로 둔다.
subtag를 extension에서 k부터 k + length까지의 부분 문자열로 둔다.
참고: 키워드는 첫 번째가 길이 2의 key이고, 이후의 것들(존재하는 경우)은 길이가 3부터 8까지의 포괄 구간에 있으며, 중간의 "-" 구분자와 함께 값을 구성하는 하위 태그들의 시퀀스이다. attribute는 모든 키워드보다 앞서는, 길이가 3부터 8까지의 포괄 구간에 있는 단일 하위 태그이다.
단언: length ≥ 2.
keyword가 undefined이고 length ≠ 2이면,
subtag가 attributes의 요소가 아니면, subtag를 attributes에 추가한다.
그렇지 않고 length = 2이면,
keyword를 Record { [[Key]]: subtag, [[Value]]: 빈 String }으로 설정한다.
keywords가 [[Key]]가 keyword.[[Key]]인 요소를 포함하지 않으면, keyword를 keywords에 추가한다.
그렇지 않고 keyword.[[Value]]가 빈 String이면,
keyword.[[Value]]를 subtag로 설정한다.
그렇지 않으면,
keyword.[[Value]]를 keyword.[[Value]], "-", 그리고 subtag의 문자열 연결로 설정한다.
k를 k + length + 1로 설정한다.
Record { [[Attributes]]: attributes, [[Keywords]]: keywords }를 반환한다.
The abstract operation ResolveOptions takes arguments ctor (service constructor), localeData (Record), locales (ECMAScript 언어 값), and options (ECMAScript 언어 값) and optional arguments specialBehaviours (enum의 List) and modifyResolutionOptions (하나의 parameter를 가진 Abstract Closure) and returns [[Options]](Object), [[ResolvedLocale]](Record), [[ResolutionOptions]](Record) 필드를 가진 Record를 포함하는 정상 완료 또는 throw 완료. ctor의 입력을 읽고 이를 locale로 resolve한다. It performs the following steps when called:
The abstract operation CoerceOptionsToObject takes argument options (ECMAScript 언어 값) and returns Object를 포함하는 정상 완료 또는 throw 완료.
options를 GetOption과 함께 사용하기에 적합한 Object로 coerce하고, 기본값은 빈 Object로 한다.
이 연산은 null이 아닌 primitive 값을 object로 coerce하므로, 새 기능에서는 GetOptionsObject를 선호하여 사용하지 않는 것이 권장된다.
It performs the following steps when called:
The abstract operation GetOption takes arguments options (Object), propertyKey (property key), type (boolean 또는 string), values (empty 또는 ECMAScript 언어 값의 List), and default (required 또는 ECMAScript 언어 값) and returns ECMAScript 언어 값을 포함하는 정상 완료 또는 throw 완료. options의 지정된 property 값을 추출하고, 필요한 type으로 변환하며, values가 empty가 아니면 그 값이 values에 의해 허용되는지 확인하고, 값이 undefined이면 default로 대체한다. It performs the following steps when called:
The abstract operation GetBooleanOrStringNumberFormatOption takes arguments options (Object), propertyKey (property key), stringValues (String의 List), and fallback (ECMAScript 언어 값) and returns Boolean, String 또는 fallback 중 하나를 포함하는 정상 완료 또는 throw 완료. 제공된 options 객체에서 propertyKey라는 이름의 property 값을 추출한다. 그 값이 undefined이면 fallback을 반환하고, 그 값이 true이면 true를 반환하며, 그 값이 false로 coerce되면 false를 반환하고, 그렇지 않으면 이를 String으로 coerce한 뒤 stringValues에 의해 허용되면 그 결과를 반환한다. It performs the following steps when called:
The abstract operation DefaultNumberOption takes arguments value (ECMAScript 언어 값), minimum (정수), maximum (정수), and fallback (정수 또는 undefined) and returns 정수 또는 undefined 중 하나를 포함하는 정상 완료 또는 throw 완료. value를 정수로 변환하고, 허용 범위 안에 있는지 확인하며, 필요하면 fallback 값을 채운다. It performs the following steps when called:
The abstract operation GetNumberOption takes arguments options (Object), propertyKey (String), minimum (정수), maximum (정수), and fallback (정수 또는 undefined) and returns 정수 또는 undefined 중 하나를 포함하는 정상 완료 또는 throw 완료. 제공된 options 객체에서 propertyKey라는 이름의 property 값을 추출하고, 이를 정수로 변환하며, 허용 범위 안에 있는지 확인하고, 필요하면 fallback 값을 채운다. It performs the following steps when called:
The abstract operation PartitionPattern takes argument pattern (Pattern String) and returns [[Type]](String) 및 [[Value]](String 또는 undefined) 필드를 가진 Record의 List.
[[Type]]이 "literal"이면 [[Value]] 필드는 String 값이 되고, 그렇지 않으면 undefined가 된다.
It performs the following steps when called:
[[AvailableLocales]] 내부 슬롯의 값은 9.1에서 설명된 제약 내에서 구현에 따라 정의된다.
[[RelevantExtensionKeys]] 내부 슬롯의 값은 "co" 요소를 반드시 포함하고, "kf"와 "kn" 요소를 임의로 포함할 수 있으며, 다른 요소는 포함하지 않아야 한다.
Note
Unicode Technical Standard #35 Part 1
Core, Section 3.6.1 Key and Type Definitions에서는 collation에 관련된 10개의 locale 확장 키를 설명한다: "co"는 collator 사용
및 특화, "ka"는 대체 처리, "kb"는 두 번째 수준 가중치의 역방향, "kc"는 대소문자 수준, "kf"는 대소문자 우선, "kh"는 히라가나 4차, "kk"는 정규화,
"kn"는 숫자, "kr"는 재정렬, "ks"는 collation 강도, 그리고 "vt"는 variable top. 그러나 Collator는 사용을 options 객체의 "usage"
속성으로, 대체 처리를 "ignorePunctuation" 속성으로, 대소문자 수준과 강도를 "sensitivity" 속성으로 지정해야 한다. 언어 태그의 "co" 키는 collator
특화에만 지원되며, "kb", "kh", "kk", "kr", "vt" 키는 이 버전의 Internationalization API에서 허용되지 않는다. 나머지 키의 지원은 구현에
따라 달라진다.
The implementation-defined abstract operation CompareStrings takes arguments collator (an Intl.Collator), x (a String), and y (a String) and returns a Number, but not NaN.
반환된 Number는 x와 y의 구현에 따라 정의된 locale 민감한 문자열 비교 결과를 나타낸다.
결과는 collator의 유효 locale 및 collation 옵션에 따라 문자열 값의 정렬 순서에 대응하도록 의도되며, x가 y보다 앞서면 음수, x가 y보다 뒤면 양수,
그 외에는 0(상대적 순서 없음)을 반환한다.
문자열 값은 ECMA-262, 6.1.4에서 설명된 대로 UTF-16 코드
유닛 시퀀스로 해석되어야 하며, 문자열 내 서러게이트 페어(0xD800~0xDBFF 범위의 코드 유닛 뒤에 0xDC00~0xDFFF 범위의 코드 유닛)는 해당 코드 포인트로 해석되어야 한다.
아래에서 설명된 동작은 문자열의 "base letter" 시퀀스의 locale 민감한 식별에 따라 달라지며, 서로 다른 base letter는 항상 다르게 비교된다(이를 포함하는 문자열도 다르게
비교됨). 같은 base letter의 변형을 대소문자, 발음 구별 부호 등으로 비교하는 결과는 collator.[[Sensitivity]]에 따라 달라진다:
Table 4: Collator Sensitivity의 효과
[[Sensitivity]]
설명
"a" vs. "á"
"a" vs. "A"
"base"
같은 base letter는 대소문자나 발음 구별 부호의 차이와 관계없이 다르게 비교되지 않는다.
동등
동등
"accent"
같은 base letter는 발음 구별 부호 등으로만 다르게 비교되며, 대소문자 차이는 무시된다.
다름
동등
"case"
같은 base letter는 대소문자 차이로만 다르게 비교되며, 발음 구별 부호 등은 무시된다.
동등
다름
"variant"
같은 base letter는 대소문자, 발음 구별 부호, 기타 차이로 다르게 비교된다.
다름
다름
Note 1
입력 코드 포인트에서 base letter로의 매핑에는 임의의 수축, 확장, 충돌이 포함될 수 있으며, 발음 구별 부호가 있는 특정 문자에 특별 처리를 적용할 수 있다. 예를 들어, 스웨덴어에서
"ö"는 "o"와 다른 base letter이고, "v"와 "w"는 같은 base letter로 간주된다. 슬로바키아어에서는 "ch"가 하나의 base letter이고, 영어에서는 "æ"가 "a"와
"e"로 시작하는 base letter 시퀀스이다.
collator.[[IgnorePunctuation]]이 true이면, 구두점은 무시된다(예: 구두점만 다른 문자열은 동등하게 비교됨).
실제 반환 값은 추가 정보를 인코딩할 수 있도록 구현에 따라 정의되지만, 특정 collator에 대해 x와 y의 함수로서 전체 문자열 집합에 대해 일관된 비교자를 정의하는 총 정렬이어야
한다. 또한 Unicode 표준에 따라 정규 등가를 인식하고, 구별 가능한 문자열이 정규 등가일 때 +0𝔽를 반환해야 한다.
11.1.1.1 ChainDateTimeFormat ( dateTimeFormat, newTarget, this )
The abstract operation ChainDateTimeFormat takes arguments dateTimeFormat (Intl.DateTimeFormat), newTarget (ECMAScript 언어 값), and this (ECMAScript 언어 값) and returns Object를 포함하는 정상 완료 또는 throw 완료. It performs the following steps when called:
The abstract operation CreateDateTimeFormat takes arguments newTarget (생성자), locales (ECMAScript 언어 값), options (ECMAScript 언어 값), required (date, time, 또는 any), and defaults (date, time, 또는 all) and returns DateTimeFormat 객체를 포함하는 정상 완료 또는 throw 완료. It performs the following steps when called:
The abstract operation FormatOffsetTimeZoneIdentifier takes argument offsetMinutes (정수) and returns String. It performs the following steps when called:
offsetMinutes ≥ 0이면 sign을 코드 단위 0x002B (PLUS SIGN)로 두고, 그렇지 않으면 sign을 코드 단위 0x002D (HYPHEN-MINUS)로 둔다.
[[LocaleData]] 내부 슬롯의 값은 9.1에 설명된 제약 조건 및 다음 추가 제약 조건 내에서, 모든 locale 값 locale에 대해 구현 정의이다:
[[LocaleData]].[[<locale>]].[[nu]]는 "native", "traditio", 또는 "finance" 값을 포함하지 않는 List여야 한다.
[[LocaleData]].[[<locale>]].[[hc]]는 « null, "h11", "h12", "h23", "h24" »여야 한다.
[[LocaleData]].[[<locale>]].[[hourCycle]]는 String "h11", "h12", "h23", 또는 "h24" 중 하나여야 한다.
[[LocaleData]].[[<locale>]].[[hourCycle12]]는 String "h11" 또는 "h12" 중 하나여야 한다.
[[LocaleData]].[[<locale>]].[[hourCycle24]]는 String "h23" 또는 "h24" 중 하나여야 한다.
[[LocaleData]].[[<locale>]]는 [[formats]] 필드를 가져야 한다. 이 [[formats]] 필드의 값은 각 calendar 값 calendar에 대한 [[<calendar>]] 필드를 가진 Record여야 한다. 각 [[<calendar>]] 필드의 값은 DateTime Format Records의 List여야 한다. 그러한 List의 여러 Record는, 대응하는 값이 적어도 하나의 필드에서 다른 한, 동일한 필드 부분집합을 사용할 수 있다. 각 locale에 대해 다음 부분집합들이 사용 가능해야 한다:
[[LocaleData]].[[<locale>]]는 [[styles]] 필드를 가져야 한다. 이 [[styles]] 필드의 값은 각 calendar 값 calendar에 대한 [[<calendar>]] 필드를 가진 Record여야 한다. 각 [[<calendar>]] 필드의 값은 DateTime Styles Record여야 한다.
레코드의 각 날짜 및 시간 형식 구성 요소 필드에 대해, "{"로 시작하고, 뒤이어 필드 이름이 오며, 뒤이어 "}"가 오는 부분 문자열을 포함한다. 레코드에 [[year]] 필드가 있으면, 문자열은 부분 문자열 "{yearName}" 및 "{relatedYear}"를 포함할 수 있다.
웹 호환성 이유로, "hourCycle" 속성이 설정되어 있으면, "hourCycle"이 "h11" 또는 "h12"일 때 "hour12" 속성은 true로, "hourCycle"이 "h23" 또는 "h24"일 때는 false로 설정되어야 한다.
Note 1
이 API 버전에서, Intl.DateTimeFormat 생성자에 제공된 options 객체에 "timeZone" 속성이 제공되지 않은 경우 "timeZone" 속성은 호스트 환경의 time zone 식별자가 된다. 초판에서는 이 경우 "timeZone" 속성이 undefined로 남아 있었다.
Note 2
다섯 번째 판 이전 버전과의 호환성을 위해, "hour12" 속성은 "hourCycle" 속성에 더해 설정된다.
11.3.3 get Intl.DateTimeFormat.prototype.format
Intl.DateTimeFormat.prototype.format은 set 접근자 함수가 undefined인 접근자 속성이다. 그 get 접근자 함수는 다음 단계를 수행한다:
[[TimeZone]]은 형식 지정에 사용되는 String으로, 사용 가능한 named time zone 식별자 또는 offset time zone 식별자 중 하나이다.
[[HourCycle]]은 12시간 형식("h11", "h12") 또는 24시간 형식("h23", "h24") 중 어느 것을 사용해야 하는지를 나타내는 String이다. "h11"과 "h23"은 각각 hour 0에서 시작하여 11 및 23까지 간다. "h12"와 "h24"는 각각 hour 1에서 시작하여 12 및 24까지 간다. [[HourCycle]]은 [[DateTimeFormat]]에 [[hour]] 필드가 있을 때에만 사용된다.
[[DateStyle]], [[TimeStyle]]은 각각 undefined, "full", "long", "medium", 또는 "short" 중 하나이다.
The abstract operation DateTimeStyleFormat takes arguments dateStyle ("full", "long", "medium", "short", 또는 undefined), timeStyle ("full", "long", "medium", "short", 또는 undefined), and styles (DateTime Styles Record) and returns DateTime Format Record. It performs the following steps when called:
#### ECMARKDOWN PARSE FAILED ####
1. 단언: _dateStyle_은 *undefined*가 아니거나 _timeStyle_은 *undefined*가 아니다.
1. _timeStyle_이 *undefined*가 아니면,
1. 단언: _timeStyle_은 *"full"*, *"long"*, *"medium"*, 또는 *"short"* 중 하나이다.
1. _timeFormat_을 _styles_.[[Time]].[[<_timeStyle_>]]로 둔다.
1. _dateStyle_이 *undefined*가 아니면,
1. 단언: _dateStyle_은 *"full"*, *"long"*, *"medium"*, 또는 *"short"* 중 하나이다.
1. _dateFormat_을 _styles_.[[Date]].[[<_dateStyle_>]]로 둔다.
1. _dateStyle_이 *undefined*가 아니고 _timeStyle_이 *undefined*가 아니면,
1. _format_을 새 DateTime Format Record로 둔다.
1. [[pattern]] 및 [[rangePatterns]]를 제외한 _dateFormat_의 모든 필드를 _format_에 추가한다.
1. [[pattern]], [[rangePatterns]], 그리고 존재한다면 [[pattern12]] 및 [[rangePatterns12]]를 제외한 _timeFormat_의 모든 필드를 _format_에 추가한다.
1. _connector_를 _styles_.[[Connector]].[[<_dateStyle_>]]로 둔다.
1. _pattern_을 _connector_ 문자열에서 부분 문자열 *"{0}"*을 _timeFormat_.[[pattern]]으로, 부분 문자열 *"{1}"*을 _dateFormat_.[[pattern]]으로 교체한 것으로 둔다.
1. _format_.[[pattern]]을 _pattern_으로 설정한다.
1. _timeFormat_에 [[pattern12]] 필드가 있으면,
1. _pattern12_를 _connector_ 문자열에서 부분 문자열 *"{0}"*을 _timeFormat_.[[pattern12]]로, 부분 문자열 *"{1}"*을 _dateFormat_.[[pattern]]으로 교체한 것으로 둔다.
1. _format_.[[pattern12]]를 _pattern12_로 설정한다.
1. _dateTimeRangeFormat_을 _styles_.[[DateTimeRangeFormat]].[[<_dateStyle_>]].[[<_timeStyle_>]]로 둔다.
1. _format_.[[rangePatterns]]를 _dateTimeRangeFormat_.[[rangePatterns]]로 설정한다.
1. _dateTimeRangeFormat_에 [[rangePatterns12]] 필드가 있으면,
1. _format_.[[rangePatterns12]]를 _dateTimeRangeFormat_.[[rangePatterns12]]로 설정한다.
1. _format_을 반환한다.
1. _timeStyle_이 *undefined*가 아니면,
1. _timeFormat_을 반환한다.
1. 단언: _dateStyle_은 *undefined*가 아니다.
1. _dateFormat_을 반환한다.
11.5.5 FormatDateTimePattern ( dateTimeFormat, format, pattern, epochNanoseconds )
The abstract operation FormatDateTimePattern takes arguments dateTimeFormat (Intl.DateTimeFormat), format (DateTime Format Record 또는 DateTime Range Pattern Format Record), pattern (Pattern String), and epochNanoseconds (BigInt) and returns [[Type]](String) 및 [[Value]](String) 필드를 가진 Records의 List. It performs the following steps when called:
Record { [[Type]]: "fractionalSecond", [[Value]]: formattedValue }를 result에 추가한다.
그렇지 않고 partType이 "dayPeriod"이면,
단언: format은 [[dayPeriod]] 필드를 가진다.
fieldFormat을 format.[[dayPeriod]]로 둔다.
formattedValue를 fieldFormat이 주는 형식으로 localTime의 day period를 나타내는 ILD String으로 둔다.
Record { [[Type]]: partType, [[Value]]: formattedValue }를 result에 추가한다.
그렇지 않고 partType이 "timeZoneName"이면,
단언: format은 [[timeZoneName]] 필드를 가진다.
fieldFormat을 format.[[timeZoneName]]로 둔다.
value를 dateTimeFormat.[[TimeZone]]으로 둔다.
formattedValue를 fieldFormat이 주는 형식으로 value를 나타내는 ILD String으로 둔다. fieldFormat이 "short", "long", "shortOffset", 또는 "longOffset"이면 그 값은 localTime의 [[InDST]] 필드 값에 의존할 수 있다. 구현이 fieldFormat의 그러한 현지화된 표현을 가지지 않는 경우, value 자체를 사용한다.
Record { [[Type]]: partType, [[Value]]: formattedValue }를 result에 추가한다.
그렇지 않고 fieldFormat이 "narrow", "short", 또는 "long"이면,
formattedValue를 fieldFormat이 주는 형식으로 value를 나타내는 ILD String으로 둔다. partType이 "month"이면, 그 값은 format에 [[day]] 필드가 있는지 여부에 의존할 수 있다. 구현이 fieldFormat의 현지화된 표현을 가지지 않는 경우, value 자체를 사용한다.
Record { [[Type]]: partType, [[Value]]: formattedValue }를 result에 추가한다.
그렇지 않고 partType이 "ampm"이면,
value를 localTime.[[Hour]]로 둔다.
value > 11이면 formattedValue를 "post meridiem"을 나타내는 ILD String으로 두고, 그렇지 않으면 formattedValue를 "ante meridiem"을 나타내는 ILD String으로 둔다.
Record { [[Type]]: "dayPeriod", [[Value]]: formattedValue }를 result에 추가한다.
Record { [[Type]]: "yearName", [[Value]]: formattedValue }를 result에 추가한다.
그렇지 않으면,
unknown을 epochNanoseconds와 partType에 기반한 ILND String으로 둔다.
Record { [[Type]]: "unknown", [[Value]]: unknown }를 result에 추가한다.
result를 반환한다.
Note
구현은 Common Locale Data Repository(https://cldr.unicode.org/에서 이용 가능)가 제공하는 locale 및 calendar 의존 문자열을 사용하고, DateTimeFormat "short" 문자열에는 CLDR "abbreviated" 문자열을, DateTimeFormat "long" 문자열에는 CLDR "wide" 문자열을 사용하는 것이 권장된다.
11.5.6 PartitionDateTimePattern ( dateTimeFormat, x )
The abstract operation PartitionDateTimePattern takes arguments dateTimeFormat (Intl.DateTimeFormat) and x (Number) and returns [[Type]](String) 및 [[Value]](String) 필드를 가진 Records의 List를 포함하는 정상 완료, 또는 throw 완료. It performs the following steps when called:
result를 FormatDateTimePattern(dateTimeFormat, format, pattern, epochNanoseconds)로 둔다.
result를 반환한다.
11.5.7 FormatDateTime ( dateTimeFormat, x )
The abstract operation FormatDateTime takes arguments dateTimeFormat (Intl.DateTimeFormat) and x (Number) and returns String을 포함하는 정상 완료 또는 throw 완료. It performs the following steps when called:
parts의 각 Record { [[Type]], [[Value]] } part에 대해, 다음을 수행한다.
result를 result와 part.[[Value]]의 문자열 연결로 설정한다.
result를 반환한다.
11.5.8 FormatDateTimeToParts ( dateTimeFormat, x )
The abstract operation FormatDateTimeToParts takes arguments dateTimeFormat (Intl.DateTimeFormat) and x (Number) and returns Array를 포함하는 정상 완료 또는 throw 완료. It performs the following steps when called:
11.5.9 PartitionDateTimeRangePattern ( dateTimeFormat, x, y )
The abstract operation PartitionDateTimeRangePattern takes arguments dateTimeFormat (Intl.DateTimeFormat), x (Number), and y (Number) and returns [[Type]](String), [[Value]](String), 그리고 [[Source]](String) 필드를 가진 Records의 List를 포함하는 정상 완료, 또는 throw 완료. It performs the following steps when called:
11.5.10 FormatDateTimeRange ( dateTimeFormat, x, y )
The abstract operation FormatDateTimeRange takes arguments dateTimeFormat (Intl.DateTimeFormat), x (Number), and y (Number) and returns String을 포함하는 정상 완료 또는 throw 완료. It performs the following steps when called:
parts의 각 Record { [[Type]], [[Value]], [[Source]] } part에 대해, 다음을 수행한다.
result를 result와 part.[[Value]]의 문자열 연결로 설정한다.
result를 반환한다.
11.5.11 FormatDateTimeRangeToParts ( dateTimeFormat, x, y )
The abstract operation FormatDateTimeRangeToParts takes arguments dateTimeFormat (Intl.DateTimeFormat), x (Number), and y (Number) and returns Array를 포함하는 정상 완료 또는 throw 완료. It performs the following steps when called:
11.5.12 ToLocalTime ( epochNs, calendar, timeZoneIdentifier )
The implementation-defined abstract operation ToLocalTime takes arguments epochNs (BigInt), calendar (String), and timeZoneIdentifier (String) and returns ToLocalTime Record. It performs the following steps when called:
UTC로부터의 time zone offset 및 daylight saving time 규칙에 관한 IANA Time Zone Database의 현재 및 역사적 정보를 포함하여, 지정된 calendar와 timeZoneIdentifier에 관해 이용 가능한 최선의 정보를 사용해 true 또는 false를 계산한다.
The abstract operation UnwrapDateTimeFormat takes argument dtf (ECMAScript 언어 값) and returns ECMAScript 언어 값을 포함하는 정상 완료 또는 throw 완료. It performs the following steps when called:
[[AvailableLocales]] 내부 슬롯의 값은 9.1에 설명된 제약 안에서 구현 정의이다.
[[RelevantExtensionKeys]] 내부 슬롯의 값은 « »이다.
[[ResolutionOptionDescriptors]] 내부 슬롯의 값은 « »이다.
[[LocaleData]] 내부 슬롯의 값은 9.1에 설명된 제약 및 다음 추가 제약 안에서 구현 정의이다:
[[LocaleData]].[[<locale>]]는 모든 locale 값 locale에 대해 [[types]] 필드를 가져야 한다. 이 필드의 값은 Record여야 하며, 모든 display name type의 이름을 가진 필드를 가져야 한다: "language", "region", "script", "currency", "calendar" 및 "dateTimeField".
필드 "language"의 값은 Record여야 하며, 유효한 language display 중 하나의 이름을 가진 필드를 가져야 한다: "dialect" 및 "standard".
display name type "language" 아래의 language display 필드는 유효한 display name style 중 하나의 이름을 가진 필드를 가져야 하는 Record를 포함해야 한다: "narrow", "short" 및 "long".
필드 "region", "script", "currency", "calendar" 및 "dateTimeField"의 값은 Record여야 하며, 모든 display name style의 이름을 가진 필드를 가져야 한다: "narrow", "short" 및 "long".
display name type "language" 아래의 display name style 필드는 unicode_language_idUnicode locale nonterminal에 의해 매칭될 수 있는 language code에 대응하는 key를 가진 Record를 포함해야 한다. 이 필드들의 값은 string 값이어야 한다.
display name type "region" 아래의 display name style 필드는 region code에 대응하는 key를 가진 Record를 포함해야 한다. 이 필드들의 값은 string 값이어야 한다.
display name type "script" 아래의 display name style 필드는 script code에 대응하는 key를 가진 Record를 포함해야 한다. 이 필드들의 값은 string 값이어야 한다.
display name type "currency" 아래의 display name style 필드는 currency code에 대응하는 key를 가진 Record를 포함해야 한다. 이 필드들의 값은 string 값이어야 한다.
display name type "calendar" 아래의 display name style 필드는 typeUnicode locale nonterminal에 의해 매칭될 수 있는 calendar identifier에 대응하는 key를 가진 Record를 포함해야 한다. 이 필드들의 값은 string 값이어야 한다.
display name type "dateTimeField" 아래의 display name style 필드는 Table 19에 나열된 code에 대응하는 key를 가진 Record를 포함해야 한다. 이 필드들의 값은 string 값이어야 한다.
Note
구현은 Common Locale Data Repository(https://cldr.unicode.org/에서 이용 가능)가 제공하는 locale 데이터를 사용하는 것이 권장된다.
12.3 Intl.DisplayNames Prototype 객체의 속성
Intl.DisplayNames prototype 객체는:
%Intl.DisplayNames.prototype%이다.
ordinary 객체이다.
Intl.DisplayNames 인스턴스가 아니며 [[InitializedDisplayNames]] 내부 슬롯 또는 Intl.DisplayNames 인스턴스 객체의 다른 내부 슬롯을 가지지 않는다.
The abstract operation CanonicalCodeForDisplayNames takes arguments type (String) and code (String) and returns String을 포함하는 정상 완료 또는 throw 완료. code가 type에 따라 well-formed code를 나타내는지 검증하고, code의 대소문자가 정규화된 형식을 반환한다. It performs the following steps when called:
The abstract operation IsValidDateTimeFieldCode takes argument field (String) and returns Boolean. field 인수가 유효한 date time field code를 나타내는지 검증한다. It performs the following steps when called:
[[AvailableLocales]] 내부 슬롯의 값은 9.1에 설명된 제약 안에서 구현 정의이다.
[[RelevantExtensionKeys]] 내부 슬롯의 값은 « "nu" »이다.
[[ResolutionOptionDescriptors]] 내부 슬롯의 값은 « { [[Key]]: "nu", [[Property]]: "numberingSystem" } »이다.
[[LocaleData]] 내부 슬롯의 값은 9.1에 설명된 제약 및 다음 추가 제약 안에서, 모든 locale 값 locale에 대해 구현 정의이다:
[[LocaleData]].[[<locale>]]는 [[nu]] 및 [[DigitalFormat]] 필드를 가진 Record여야 한다.
[[LocaleData]].[[<locale>]].[[nu]]는 16.2.3에 명시된 List여야 하며, "native", "traditio" 또는 "finance" 값을 포함해서는 안 된다.
[[LocaleData]].[[<locale>]].[[DigitalFormat]]은 locale에 대해 사용할 수 있는 각 numbering system에 대응하는 key를 가진 Record여야 한다. 그러한 key 중 하나와 연결된 각 값은 다음 필드를 포함하는 Record여야 한다:
[[HourMinuteSeparator]]는 style "numeric" 또는 "2-digit"을 사용할 때 locale과 numbering system의 그 조합에 대해 hours와 minutes 사이의 적절한 구분자인 String 값이어야 한다.
[[MinuteSecondSeparator]]는 style "numeric" 또는 "2-digit"을 사용할 때 locale과 numbering system의 그 조합에 대해 minutes와 seconds 사이의 적절한 구분자인 String 값이어야 한다.
[[TwoDigitHours]]는 style "numeric"을 사용할 때 hours가 항상 두 자리로 표시되는지를 나타내는 Boolean 값이어야 한다.
Note
구현은 Common Locale Data Repository(http://cldr.unicode.org/에서 이용 가능)가 제공하는 locale 데이터를 사용하는 것이 권장된다.
13.3 Intl.DurationFormat Prototype 객체의 속성
Intl.DurationFormat prototype 객체는:
%Intl.DurationFormat.prototype%이다.
ordinary 객체이다.
Intl.DurationFormat 인스턴스가 아니며 [[InitializedDurationFormat]] 내부 슬롯 또는 Intl.DurationFormat 인스턴스 객체의 다른 내부 슬롯을 가지지 않는다.
The abstract operation ToIntegerIfIntegral takes argument arg (ECMAScript 언어 값) and returns 정수를 포함하는 정상 완료 또는 throw 완료. arg를 그 Number 값을 나타내는 정수로 변환하거나, 그 값이 integral이 아닐 때 RangeError를 던진다. It performs the following steps when called:
The abstract operation ToDurationRecord takes argument input (ECMAScript 언어 값) and returns Duration Record를 포함하는 정상 완료 또는 throw 완료. Duration을 나타내는 주어진 객체를 Duration Record로 변환한다. It performs the following steps when called:
The abstract operation DurationSign takes argument duration (Duration Record) and returns -1, 0 또는 1. duration 인수에서 가장 중요한 0이 아닌 필드가 양수이면 1을 반환하고, 가장 중요한 0이 아닌 필드가 음수이면 -1을 반환한다. duration의 모든 필드가 0이면 0을 반환한다. It performs the following steps when called:
« duration.[[Years]], duration.[[Months]], duration.[[Weeks]], duration.[[Days]], duration.[[Hours]], duration.[[Minutes]], duration.[[Seconds]], duration.[[Milliseconds]], duration.[[Microseconds]], duration.[[Nanoseconds]] »의 각 값 v에 대해, 다음을 수행한다.
The abstract operation IsValidDuration takes arguments years (정수), months (정수), weeks (정수), days (정수), hours (정수), minutes (정수), seconds (정수), milliseconds (정수), microseconds (정수), and nanoseconds (정수) and returns Boolean. 인수들이 Duration Record를 구성할 수 있는 유효한 입력을 형성하면 true를 반환하고, 그렇지 않으면 false를 반환한다. It performs the following steps when called:
sign을 0으로 둔다.
« years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds »의 각 값 v에 대해, 다음을 수행한다.
NOTE: 위 단계는 floating-point arithmetic을 사용해 직접 구현할 수 없다. 각각 10-3, 10-6 및 10-9를 곱하는 것은 milliseconds, microseconds 또는 nanoseconds가 unsafe integer일 때 부정확할 수 있다. 이 곱셈은 충분한 quotient bit를 가진 std::remquo() 구현을 사용하여 C++로 구현할 수 있다. 곱셈이 10의 거듭제곱에 의한 것이므로 string 조작도 정확한 결과를 제공한다.
The abstract operation GetDurationUnitOptions takes arguments unit (String), options (Object), baseStyle (String), stylesList (String의 List), digitalBase (String), prevStyle (String), and twoDigitHours (Boolean) and returns Duration Unit Options Record를 포함하는 정상 완료 또는 throw 완료. 주어진 임의의 unit에 대해 Object에서 관련 options를 추출하고 이를 Record로 반환한다. It performs the following steps when called:
style을 ? GetOption(options, unit, string, stylesList, undefined)로 둔다.
displayDefault를 "always"로 둔다.
style이 undefined이면,
baseStyle이 "digital"이면,
style을 digitalBase로 설정한다.
unit이 "hours", "minutes" 또는 "seconds" 중 하나가 아니면 displayDefault를 "auto"로 설정한다.
그렇지 않고 prevStyle이 "fractional", "numeric" 또는 "2-digit" 중 하나이면,
style을 "numeric"으로 설정한다.
unit이 "minutes" 또는 "seconds"가 아니면 displayDefault를 "auto"로 설정한다.
13.5.6.2 ValidateDurationUnitStyle ( unit, style, display, prevStyle )
The abstract operation ValidateDurationUnitStyle takes arguments unit (String), style (String), display (String), and prevStyle (String) and returns unused를 포함하는 정상 완료 또는 throw 완료. It performs the following steps when called:
The abstract operation ComputeFractionalDigits takes arguments durationFormat (DurationFormat Object) and duration (Duration Record) and returns 수학 값. durationFormat에서 "fractional" style을 사용하는 모든 unit 값의 합을, "fractional" style을 사용하지 않는 durationFormat의 가장 작은 unit의 fraction으로 표현하여 계산한다. It performs the following steps when called:
value를 현재 행의 Value Field 값이 이름인 duration의 필드 값으로 둔다.
result를 result + (value / 10exponent)로 설정한다.
exponent를 exponent + 3으로 설정한다.
result를 반환한다.
13.5.8 NextUnitFractional ( durationFormat, unit )
The abstract operation NextUnitFractional takes arguments durationFormat (DurationFormat Object) and unit (String) and returns Boolean. 다음으로 작은 unit이 "fractional" style을 사용하면 true를 반환한다. It performs the following steps when called:
The abstract operation FormatNumericHours takes arguments durationFormat (DurationFormat 객체), hoursValue (정수), and signDisplayed (Boolean) and returns Record의 List. hoursValue는 hours의 수를 나타내는 정수이다. durationFormat의 유효 locale 및 형식화 options에 따라 hoursValue에 대한 부분을 생성한다. It performs the following steps when called:
The abstract operation FormatNumericMinutes takes arguments durationFormat (DurationFormat Object), minutesValue (정수), hoursDisplayed (Boolean), and signDisplayed (Boolean) and returns Record의 List. minutesValue는 minutes의 수를 나타내는 정수이다. durationFormat의 유효 locale 및 형식화 options에 따라 minutesValue에 대한 부분을 생성한다. It performs the following steps when called:
The abstract operation FormatNumericSeconds takes arguments durationFormat (DurationFormat Object), secondsValue (수학 값), minutesDisplayed (Boolean), and signDisplayed (Boolean) and returns Record의 List. secondsValue는 seconds의 수를 나타내는 수학 값이다. durationFormat의 유효 locale 및 형식화 options에 따라 secondsValue에 대한 부분을 생성한다. It performs the following steps when called:
The abstract operation FormatNumericUnits takes arguments durationFormat (DurationFormat Object), duration (Duration Record), firstNumericUnit (String), and signDisplayed (Boolean) and returns Record의 List. durationFormat의 유효 locale 및 형식화 options에 따라 "numeric" 또는 "2-digit" style을 사용하는 duration의 요소를 나타내는 부분을 생성한다. It performs the following steps when called:
Assert: firstNumericUnit은 "hours", "minutes" 또는 "seconds"이다.
The abstract operation ListFormatParts takes arguments durationFormat (DurationFormat Object) and partitionedPartsList (Record의 List들의 List) and returns List. durationFormat의 유효 locale 및 형식화 options에 따라 partitionedPartsList 안의 List에 있는 부분에 대응하는 List를 생성한다. It performs the following steps when called:
The abstract operation PartitionDurationFormatPattern takes arguments durationFormat (DurationFormat) and duration (Duration Record) and returns List. durationFormat의 유효 locale 및 형식화 options에 따라 duration에 대응하는 부분을 생성한다. It performs the following steps when called:
[[AvailableLocales]] 내부 슬롯의 값은 9.1에 설명된 제약 안에서 구현 정의이다.
[[RelevantExtensionKeys]] 내부 슬롯의 값은 « »이다.
[[ResolutionOptionDescriptors]] 내부 슬롯의 값은 « »이다.
Note 1
Intl.ListFormat에는 관련 extension key가 없다.
[[LocaleData]] 내부 슬롯의 값은 9.1에 설명된 제약 및 다음 추가 제약 안에서, %Intl.ListFormat%.[[AvailableLocales]]의 각 locale 값 locale에 대해 구현 정의이다:
[[LocaleData]].[[<locale>]]는 세 필드 [[conjunction]], [[disjunction]] 및 [[unit]]을 가진 Record이다. 이들 각각은 세 formatting style의 이름인 [[long]], [[short]] 및 [[narrow]] 필드를 가져야 하는 Record이다.
그 각 필드는 ListFormat template set으로 간주되며, [[Pair]], [[Start]], [[Middle]] 및 [[End]]라는 이름의 필드를 가진 Record의 List여야 한다. 그 각 필드는 LDML List Format Rules에 명시된 template string이어야 한다. 각 template string은 부분 문자열 "{0}" 및 "{1}"을 정확히 한 번씩 포함해야 한다. 부분 문자열 "{0}"은 부분 문자열 "{1}"보다 앞에 나타나는 것이 좋다.
Note 2
구현은 Common Locale Data Repository(https://cldr.unicode.org/에서 이용 가능)가 제공하는 locale 데이터를 사용하는 것이 권장된다. LDML의 listPattern에서 conjunction은 "standard"에 대응하고, disjunction은 "or"에 대응하며, unit은 "unit"에 대응한다.
Note 3
list type 중에서 conjunction은 "and" 기반 list(예: "A, B, and C")를 의미하고, disjunction은 "or" 기반 list(예: "A, B, or C")를 의미하며, unit은 unit을 가진 값의 list(예: "5 pounds, 12 ounces")를 의미한다.
14.3 Intl.ListFormat Prototype 객체의 속성
Intl.ListFormat prototype 객체는:
%Intl.ListFormat.prototype%이다.
ordinary 객체이다.
Intl.ListFormat 인스턴스가 아니며 [[InitializedListFormat]] 내부 슬롯 또는 Intl.ListFormat 인스턴스 객체의 다른 내부 슬롯을 가지지 않는다.
The abstract operation CreatePartsFromList takes arguments listFormat (Intl.ListFormat) and list (String의 List) and returns [[Type]]("element" 또는 "literal") 및 [[Value]](String) 필드를 가진 Record의 List. listFormat의 유효 locale 및 formatting options에 따라 대응하는 parts의 List를 생성한다. It performs the following steps when called:
여러 template 중에서 선택하는 index n은 스페인어에서처럼 뒤따르는 단어에 따라 "y" 또는 "e"가 선택될 수 있는 경우와 같이 conjunction이 context에 의존할 수 있게 한다.
14.5.3 FormatList ( listFormat, list )
The abstract operation FormatList takes arguments listFormat (Intl.ListFormat) and list (String의 List) and returns String. It performs the following steps when called:
parts의 각 Record { [[Type]], [[Value]] } part에 대해, 다음을 수행한다.
result를 result와 part.[[Value]]의 문자열 연결로 설정한다.
result를 반환한다.
14.5.4 FormatListToParts ( listFormat, list )
The abstract operation FormatListToParts takes arguments listFormat (Intl.ListFormat) and list (String의 List) and returns Array. It performs the following steps when called:
The abstract operation StringListFromIterable takes argument iterable (ECMAScript 언어 값) and returns String의 List를 포함하는 정상 완료 또는 throw 완료. It performs the following steps when called:
Intl.Locale 함수가 인수 tag 및 선택적 인수 options와 함께 호출되면 다음 단계가 수행된다:
#### ECMARKDOWN PARSE FAILED ####
1. NewTarget이 *undefined*이면, *TypeError* 예외를 던진다.
1. _localeExtensionKeys_를 %Intl.Locale%.[[LocaleExtensionKeys]]로 둔다.
1. _internalSlotsList_를 « [[InitializedLocale]], [[Locale]], [[Calendar]], [[Collation]], [[FirstDayOfWeek]], [[HourCycle]], [[NumberingSystem]] »로 둔다.
1. _localeExtensionKeys_가 *"kf"*를 포함하면,
1. [[CaseFirst]]를 _internalSlotsList_에 추가한다.
1. _localeExtensionKeys_가 *"kn"*을 포함하면,
1. [[Numeric]]을 _internalSlotsList_에 추가한다.
1. _locale_을 ? OrdinaryCreateFromConstructor(NewTarget, *"%Intl.Locale.prototype%"*, _internalSlotsList_)로 둔다.
1. _tag_가 String도 아니고 Object도 아니면, *TypeError* 예외를 던진다.
1. _tag_가 Object이고 _tag_가 [[InitializedLocale]] 내부 슬롯을 가지면,
1. _tag_를 _tag_.[[Locale]]로 설정한다.
1. 그렇지 않으면,
1. _tag_를 ? ToString(_tag_)으로 설정한다.
1. _options_를 ? CoerceOptionsToObject(_options_)로 설정한다.
1. IsWellFormedLanguageTag(_tag_)가 *false*이면, *RangeError* 예외를 던진다.
1. 참고: LanguageId 정규화는 supplementalMetadata.xml의 Alias Rules에 따라 _tag_를 임의의 방식으로 변경할 수 있으므로, _options_의 재정의를 적용하기 전에 그러한 정규화를 수행해야 한다.
1. _tag_를 CanonicalizeUnicodeLocaleId(_tag_)로 설정한다.
1. _tag_를 ? UpdateLanguageId(_tag_, _options_)로 설정한다.
1. _opt_를 새 Record로 둔다.
1. _calendar_를 ? GetOption(_options_, *"calendar"*, ~string~, ~empty~, *undefined*)로 둔다.
1. _calendar_가 *undefined*가 아니면,
1. _calendar_가 type Unicode locale 비종단 기호와 일치할 수 없으면, *RangeError* 예외를 던진다.
1. _opt_.[[ca]]를 _calendar_로 설정한다.
1. _collation_을 ? GetOption(_options_, *"collation"*, ~string~, ~empty~, *undefined*)로 둔다.
1. _collation_이 *undefined*가 아니면,
1. _collation_이 type Unicode locale 비종단 기호와 일치할 수 없으면, *RangeError* 예외를 던진다.
1. _opt_.[[co]]를 _collation_으로 설정한다.
1. _fw_를 ? GetOption(_options_, *"firstDayOfWeek"*, ~string~, ~empty~, *undefined*)로 둔다.
1. _fw_가 *undefined*가 아니면,
1. _fw_를 WeekdayToUValue(_fw_)로 설정한다.
1. _fw_가 type Unicode locale 비종단 기호와 일치할 수 없으면, *RangeError* 예외를 던진다.
1. _opt_.[[fw]]를 _fw_로 설정한다.
1. _hc_를 ? GetOption(_options_, *"hourCycle"*, ~string~, « *"h11"*, *"h12"*, *"h23"*, *"h24"* », *undefined*)로 둔다.
1. _opt_.[[hc]]를 _hc_로 설정한다.
1. _kf_를 ? GetOption(_options_, *"caseFirst"*, ~string~, « *"upper"*, *"lower"*, *"false"* », *undefined*)로 둔다.
1. _opt_.[[kf]]를 _kf_로 설정한다.
1. _kn_을 ? GetOption(_options_, *"numeric"*, ~boolean~, ~empty~, *undefined*)로 둔다.
1. _kn_이 *undefined*가 아니면, _kn_을 ! ToString(_kn_)으로 설정한다.
1. _opt_.[[kn]]을 _kn_으로 설정한다.
1. _numberingSystem_을 ? GetOption(_options_, *"numberingSystem"*, ~string~, ~empty~, *undefined*)로 둔다.
1. _numberingSystem_이 *undefined*가 아니면,
1. _numberingSystem_이 type Unicode locale 비종단 기호와 일치할 수 없으면, *RangeError* 예외를 던진다.
1. _opt_.[[nu]]를 _numberingSystem_으로 설정한다.
1. _localeRecord_를 MakeLocaleRecord(_tag_, _opt_, _localeExtensionKeys_)로 둔다.
1. _locale_.[[Locale]]을 _localeRecord_.[[locale]]로 설정한다.
1. _locale_.[[Calendar]]를 _localeRecord_.[[ca]]로 설정한다.
1. _locale_.[[Collation]]을 _localeRecord_.[[co]]로 설정한다.
1. _locale_.[[FirstDayOfWeek]]를 _localeRecord_.[[fw]]로 설정한다.
1. _locale_.[[HourCycle]]을 _localeRecord_.[[hc]]로 설정한다.
1. _localeExtensionKeys_가 *"kf"*를 포함하면,
1. _locale_.[[CaseFirst]]를 _localeRecord_.[[kf]]로 설정한다.
1. _localeExtensionKeys_가 *"kn"*을 포함하면,
1. _localeRecord_.[[kn]]이 *"true"* 또는 빈 String 중 하나이면,
1. _locale_.[[Numeric]]을 *true*로 설정한다.
1. 그렇지 않으면,
1. _locale_.[[Numeric]]을 *false*로 설정한다.
1. _locale_.[[NumberingSystem]]을 _localeRecord_.[[nu]]로 설정한다.
1. _locale_을 반환한다.
15.1.2 UpdateLanguageId ( tag, options )
The abstract operation UpdateLanguageId takes arguments tag (well-formed language tag) and options (Object) and returns well-formed language tag를 포함하는 정상 완료 또는 throw 완료. tag의 unicode_language_idsubtag를 options의 대응하는 속성에서 가져온 값으로 갱신하고, 이를 검증한 뒤 결과를 반환한다. It performs the following steps when called:
이 속성은 { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false } 속성을 가진다.
15.2.2 내부 슬롯
[[LocaleExtensionKeys]] 내부 슬롯의 값은 « "ca", "co", "fw", "hc", "nu" »의 모든 요소를 반드시 포함하고, %Intl.Collator%.[[RelevantExtensionKeys]]의 요소이기도 한 « "kf", "kn" »의 임의 요소를 추가로 포함해야 하며, 다른 요소를 포함해서는 안 되는 List이다.
15.3 Intl.Locale Prototype 객체의 속성
Intl.Locale prototype 객체는:
%Intl.Locale.prototype%이다.
ordinary 객체이다.
Intl.Locale 인스턴스가 아니며 [[InitializedLocale]] 내부 슬롯 또는 Intl.Locale 인스턴스 객체의 다른 내부 슬롯을 가지지 않는다.
[[CaseFirst]]는 undefined이거나 String 값 "upper", "lower" 또는 "false" 중 하나이다. 이 내부 슬롯은 %Intl.Locale%의 [[LocaleExtensionKeys]] 내부 슬롯이 "kf"를 포함하는 경우에만 존재한다.
[[Numeric]]은 undefined이거나 locale에서 numeric sorting이 사용되는지 여부를 지정하는 Boolean 값이다. 이 내부 슬롯은 %Intl.Locale%의 [[LocaleExtensionKeys]] 내부 슬롯이 "kn"을 포함하는 경우에만 존재한다.
15.5 Locale 객체를 위한 추상 연산
15.5.1 GetLocaleBaseName ( locale )
The abstract operation GetLocaleBaseName takes argument locale (String) and returns String. It performs the following steps when called:
NOTE: unicode_region_subtagsubtag는 초기 unicode_language_subtagsubtag 바로 뒤에서만 유효하며, 선택적으로 그 사이에 단일 unicode_script_subtagsubtag가 있을 수 있다. 그 위치에서 unicode_region_subtag는 다른 유효한 subtag와 혼동될 수 없다. 이들의 모든 productions가 서로소이기 때문이다.
참고: baseName에서 "-" 앞에 오는 각 하위 태그는 unicode_script_subtag, unicode_region_subtag, 또는 unicode_variant_subtag 중 하나이지만, unicode_variant_subtag와 일치하는 모든 부분 문자열은 다른 생성식 중 하나와도 일치할 수 있는 그 어떤 접두사보다도 엄격히 더 길다.
The abstract operation UnicodeExtensionValue takes arguments locale (Unicode canonicalized locale identifier) and key (String) and returns String 또는 empty. It performs the following steps when called:
The abstract operation CanonicalUnicodeSubdivision takes arguments locale (Unicode canonicalized locale identifier) and key ("rg" 또는 "sd") and returns String 또는 undefined. It performs the following steps when called:
The abstract operation RegionPreference takes argument locale (Unicode canonicalized locale identifier) and returns [[Region]](String) 및 [[RegionOverride]](String 또는 undefined) 필드를 가진 Record. It performs the following steps when called:
calendarsInUse를 lookupRegion에서 date and time formatting에 공통적으로 사용되는 고유한 calendar type의 List로 둔다. 이는 lookupRegion에서 사용 선호도의 내림차순으로 정렬된다. lookupRegion에 대한 calendar preference data가 없으면 list는 비어 있다.
The implementation-defined abstract operation CollationsOfLocale takes argument loc (Intl.Locale) and returns Array. It performs the following steps when called:
regionOverride를 preference.[[RegionOverride]]로 둔다.
regionOverride가 undefined가 아니고 regionOverride에 대한 time data가 이용 가능하면,
lookupRegion을 regionOverride로 둔다.
그렇지 않으면,
lookupRegion을 region으로 둔다.
list를 고유한 hour cycle identifier의 List로 둔다. 이는 12-hour format("h11", "h12") 또는 24-hour format("h23", "h24") 중 하나를 나타내는 lowercase String 값이어야 하며, lookupRegion에서 date and time formatting에 공통적으로 사용되는 것들의 내림차순 선호도로 정렬된다. lookupRegion에 대한 time data가 없으면 list는 비어 있다.
The implementation-defined abstract operation NumberingSystemsOfLocale takes argument loc (Intl.Locale) and returns Array. It performs the following steps when called:
The implementation-defined abstract operation TimeZonesOfLocale takes argument loc (Intl.Locale) and returns Array 또는 undefined. It performs the following steps when called:
list를 고유한 canonical time zone identifier의 List로 둔다. 이는 IANA Time Zone Database의 canonical Zone name을 나타내는 String 값이어야 하며, region에서 공통적으로 사용되는 것들이다. region에서 공통적으로 사용되는 time zone이 없으면 list는 비어 있다. list는 lexicographic code unit order에 따라 정렬된다.
script에서 line 내 character의 default general ordering이 right-to-left이면 "rtl"을 반환한다.
script에서 line 내 character의 default general ordering이 left-to-right이면 "ltr"을 반환한다.
undefined를 반환한다.
Note 1
script에서 line 내 character의 default general ordering 방향을 결정할 수 없거나, 그 방향이 right-to-left도 left-to-right도 아니면 undefined가 반환된다.
Note 2
어떤 언어의 text는 둘 이상의 가능한 방향을 가질 수 있다. 한 script로 쓰인 언어의 text 또한 둘 이상의 가능한 방향을 가질 수 있다. 따라서 text 조각과 연결된 metadata에 direction 정보가 포함되어 있다면, 그 direction 정보가 primary source of truth로 간주되어야 한다. TextDirectionOfLocale이 반환하는 정보는 text와 연결된 metadata가 없어 text의 direction 정보를 제공하지 못할 때의 fallback mechanism으로만 사용되어야 한다. direction 정보가 없지만 language 정보가 알려져 있을 때에만 사용해야 한다. Web developer는 text의 direction을 결정하기 위해 이 API에 과도하게 의존해서는 안 된다.
16.1.1.1 ChainNumberFormat ( numberFormat, newTarget, this )
The abstract operation ChainNumberFormat takes arguments numberFormat (Intl.NumberFormat), newTarget (ECMAScript 언어 값), and this (ECMAScript 언어 값) and returns Object를 포함하는 정상 완료 또는 throw 완료. It performs the following steps when called:
The abstract operation SetNumberFormatDigitOptions takes arguments intlObj (Object), options (Object), mnfdDefault (정수), mxfdDefault (정수), and notation (String) and returns unused를 포함하는 정상 완료 또는 throw 완료. locale-independent number rounding에 영향을 주는 intlObj의 내부 슬롯을 채운다(16.5.3 참조). It performs the following steps when called:
mnid를 ? GetNumberOption(options, "minimumIntegerDigits", 1, 21, 1)로 둔다.
mnfd를 ? Get(options, "minimumFractionDigits")로 둔다.
mxfd를 ? Get(options, "maximumFractionDigits")로 둔다.
mnsd를 ? Get(options, "minimumSignificantDigits")로 둔다.
mxsd를 ? Get(options, "maximumSignificantDigits")로 둔다.
intlObj.[[MinimumIntegerDigits]]를 mnid로 설정한다.
roundingIncrement를 ? GetNumberOption(options, "roundingIncrement", 1, 5000, 1)로 둔다.
The abstract operation SetNumberFormatUnitOptions takes arguments intlObj (Intl.NumberFormat) and options (Object) and returns unused를 포함하는 정상 완료 또는 throw 완료. unit과 관련된 사용자 지정 options를 intlObj에 resolve한다. It performs the following steps when called:
[[AvailableLocales]] 내부 슬롯의 값은 9.1에 설명된 제약 안에서 구현 정의이다.
[[RelevantExtensionKeys]] 내부 슬롯의 값은 « "nu" »이다.
[[ResolutionOptionDescriptors]] 내부 슬롯의 값은 « { [[Key]]: "nu", [[Property]]: "numberingSystem" } »이다.
Note 1
Unicode Technical Standard #35 Part 1 Core, Section 3.6.1 Key and Type Definitions는 number formatting과 관련된 세 locale extension key를 설명한다. currency용 "cu", currency format style용 "cf", 그리고 numbering system용 "nu"이다. 그러나 Intl.NumberFormat은 currency format의 currency가 options 객체의 currency property를 통해 지정되고, currency format의 currency format style이 options 객체의 currencySign property를 통해 지정될 것을 요구한다.
[[LocaleData]] 내부 슬롯의 값은 9.1에 설명된 제약 및 다음 추가 제약 안에서 구현 정의이다:
[[LocaleData]]의 임의 locale 필드의 "nu" 필드 값인 List는 "native", "traditio" 또는 "finance" 값을 포함해서는 안 된다.
[[LocaleData]].[[<locale>]]는 모든 locale 값 locale에 대해 [[patterns]] 필드를 가져야 한다. 이 필드의 값은 Record여야 하며, 네 number format style의 이름인 "decimal", "percent", "currency" 및 "unit" 필드를 가져야 한다.
위에 언급된 두 필드 "currency" 및 "unit"은 적어도 하나의 필드 "fallback"을 가진 Record여야 한다.
"currency"는 6.3에 따른 currency code에 대응하는 key를 가진 추가 필드를 가질 수 있다.
"currency"의 각 필드는 가능한 currencyDisplay 값 "code", "symbol", "narrowSymbol" 및 "name"에 대응하는 필드를 가진 Record여야 한다.
그 각 필드는 가능한 currencySign 값 "standard" 또는 "accounting"에 대응하는 필드를 가진 Record를 포함해야 한다. ([[LocaleData]].[[<locale>]]의) "unit" 필드는 필수 필드 "fallback" 외에도 6.6에 대응하는 core measurement unit identifier에 대응하는 key를 가진 추가 필드를 가질 수 있다.
"unit"의 각 필드는 가능한 unitDisplay 값 "narrow", "short" 및 "long"에 대응하는 필드를 가진 Record여야 한다.
지금까지 patterns tree에 대해 설명한 모든 leaf 필드("decimal", "percent", "currency"의 great-grandchildren 및 "unit"의 grandchildren)는 key "positivePattern", "zeroPattern" 및 "negativePattern"을 가진 Record여야 한다.
앞서 언급한 필드(sign-dependent pattern fields)의 값은 반드시 substring"{number}"를 포함하는 string 값이어야 한다.
"positivePattern"은 substring"{plusSign}"를 포함해야 하지만 "{minusSign}"는 포함해서는 안 된다. "negativePattern"은 substring"{minusSign}"를 포함해야 하지만 "{plusSign}"는 포함해서는 안 된다. 그리고 "zeroPattern"은 "{plusSign}" 또는 "{minusSign}" 어느 것도 포함해서는 안 된다.
추가로, "percent" 필드 안의 값은 substring"{percentSign}"도 포함해야 한다. "currency" 필드 안의 값은 다음 substring 중 하나 이상을 포함해야 한다: "{currencyCode}", "{currencyPrefix}", 또는 "{currencySuffix}". 그리고 "unit" 필드 안의 값은 다음 substring 중 하나 이상을 포함해야 한다: "{unitPrefix}" 또는 "{unitSuffix}".
pattern string은 ECMA-262, 6.1.4에 설명된 것처럼 UTF-16으로 인코딩된 code point 시퀀스로 해석될 때, Unicode Standard에 명시된 General Category "Number, decimal digit"의 code point를 포함해서는 안 된다.
[[LocaleData]].[[<locale>]]는 모든 locale 값 locale에 대해 [[notationSubPatterns]] 필드도 가져야 한다. 이 필드의 값은 Record여야 하며, 두 필드 [[scientific]] 및 [[compact]]를 가져야 한다. [[scientific]] 필드는 substring"{number}", "{scientificSeparator}" 및 "{scientificExponent}"를 포함하는 string 값이어야 한다. [[compact]] 필드는 두 필드 "short" 및 "long"을 가진 Record여야 한다. 이 각 필드는 구현이 compact notation에 대해 지원하는 모든 discrete magnitude에 대응하는 integer key를 가진 Record여야 한다. 이 각 필드는 substring"{number}"를 포함할 수 있는 string 값이어야 한다. "short"에서 내려온 string은 substring"{compactSymbol}"를 포함해야 하며, "long"에서 내려온 string은 substring"{compactName}"를 포함해야 한다.
Note 2
구현은 Common Locale Data Repository(https://cldr.unicode.org/에서 이용 가능)가 제공하는 locale 데이터를 사용하는 것이 권장된다.
16.3 Intl.NumberFormat Prototype 객체의 속성
Intl.NumberFormat prototype 객체는:
%Intl.NumberFormat.prototype%이다.
ordinary 객체이다.
Intl.NumberFormat 인스턴스가 아니며 [[InitializedNumberFormat]] 내부 슬롯 또는 Intl.NumberFormat 인스턴스 객체의 다른 내부 슬롯을 가지지 않는다.
반환된 함수는 nf에 bound되어 Array.prototype.map 또는 다른 함수에 직접 전달될 수 있다.
이는 historical artefact로 간주되며, 새 기능에서는 더 이상 따르지 않는 관례의 일부이지만, 기존 프로그램과의 compatibility를 유지하기 위해 보존된다.
16.3.4 Intl.NumberFormat.prototype.formatRange ( start, end )
formatRange 메서드가 인수 start 및 end와 함께 호출되면 다음 단계가 수행된다:
[[Style]]은 측정되는 수량의 type을 식별하는 String 값 "decimal", "currency", "percent" 또는 "unit" 중 하나이다.
[[Currency]]는 "currency" unit type으로 형식화할 때 사용할 currency를 식별하는 currency code를 가진 String 값이다. 이는 [[Style]] 값이 "currency"일 때에만 사용된다.
[[CurrencyDisplay]]는 "currency" style로 형식화할 때 currency를 ISO 4217 alphabetic currency code, localized currency symbol 또는 localized currency name으로 표시할지 지정하는 String 값 "code", "symbol", "narrowSymbol" 또는 "name" 중 하나이다. 이는 [[Style]] 값이 "currency"일 때에만 사용된다.
[[CurrencySign]]은 negative number를 accounting format으로 렌더링할지 지정하는 String 값 "standard" 또는 "accounting" 중 하나이며, 보통 parenthesis로 표시된다. 이는 [[Style]] 값이 "currency"이고 [[SignDisplay]]가 "never"가 아닐 때에만 사용된다.
[[UnitDisplay]]는 "unit" style로 형식화할 때 unit을 symbol, narrow symbol 또는 localized long name으로 표시할지 지정하는 String 값 "short", "narrow" 또는 "long" 중 하나이다. 이는 [[Style]] 값이 "unit"일 때에만 사용된다.
[[MinimumIntegerDigits]]는 사용할 최소 integer digits를 나타내는 non-negative integer이다. 필요하면 number는 leading zero로 padding된다.
[[MinimumFractionDigits]] 및 [[MaximumFractionDigits]]는 사용할 최소 및 최대 fraction digits를 나타내는 non-negative integer이다. 필요하면 number는 반올림되거나 trailing zero로 padding된다. 이러한 속성은 [[RoundingType]]이 fraction-digits, more-precision 또는 less-precision일 때에만 사용된다.
[[MinimumSignificantDigits]] 및 [[MaximumSignificantDigits]]는 표시할 최소 및 최대 fraction digits를 나타내는 positive integer이다. 존재하면 formatter는 지정된 significant digits 수를 표시하는 데 필요한 만큼의 fraction digits를 사용한다. 이러한 속성은 [[RoundingType]]이 significant-digits, more-precision 또는 less-precision일 때에만 사용된다.
[[UseGrouping]]은 grouping separator를 사용해야 하는 조건을 나타내는 Boolean 또는 String 값이다. grouping separator의 위치와 formatted number에 grouping separator를 표시할지 여부는 구현 정의이다. 값 "always"는 가능하면 grouping separator를 표시하도록 구현에 hint를 준다. "min2"는 group에 적어도 2개의 digit가 있는 경우, "auto"는 locale이 formatted number에 grouping separator 사용을 선호하는 경우이다. 값 false는 grouping separator를 비활성화한다.
[[RoundingType]]은 사용할 rounding strategy를 나타내는 fraction-digits, significant-digits, more-precision 또는 less-precision 중 하나의 값이다. fraction-digits이면 formatted number는 위에 설명된 것처럼 [[MinimumFractionDigits]] 및 [[MaximumFractionDigits]]에 따라 반올림된다. significant-digits이면 formatted number는 위에 설명된 것처럼 [[MinimumSignificantDigits]] 및 [[MaximumSignificantDigits]]에 따라 반올림된다. more-precision 또는 less-precision이면 네 설정 모두가 사용되며, 어느 set를 사용할지 disambiguate하는 specific rule이 적용된다. [[RoundingType]]은 "roundingPriority" option에서 도출된다.
[[ComputedRoundingPriority]]는 String 값 "auto", "morePrecision" 또는 "lessPrecision" 중 하나이다. 이는 [[RoundingType]]을 유효한 "roundingPriority" option으로 다시 변환하기 위해 16.3.2에서만 사용된다.
[[Notation]]은 formatted number가 scaling 없이 표시될지, scientific notation에서 power of ten을 사용해 units place로 scaling될지, scientific notation에서 power of ten을 사용해 nearest thousand로 scaling될지, 또는 대응하는 compact decimal notation affix와 함께 nearest ILD compact decimal notation power of ten으로 scaling될지를 지정하는 String 값 "standard", "scientific", "engineering" 또는 "compact" 중 하나이다.
[[CompactDisplay]]는 compact notation affix를 short form("5K") 또는 long form("5 thousand")으로 표시할지 지정하는 "short", "long" 또는 undefined 중 하나이다. [[Notation]]이 "compact" 이외의 값을 가질 때 그리고 그때에만 undefined이다.
[[SignDisplay]]는 sign을 언제 포함할지 지정하는 String 값 "auto", "always", "never", "exceptZero" 또는 "negative" 중 하나이다(non-"auto" options는 각각 항상 포함, 절대 포함하지 않음, non-zero number에만 포함, 또는 non-zero negative number에만 포함에 대응한다).
scientific notation에서 이 슬롯은 mantissa의 sign display에 영향을 주지만 exponent에는 영향을 주지 않는다.
[[RoundingIncrement]]는 10, 100, 1000 또는 10000을 tenths, fifths, quarters 또는 halves로 균등하게 나누는 정수이다. 이는 계산된 rounding magnitude를 기준으로 rounding이 이루어져야 하는 increment를 나타낸다. 예를 들어 [[MaximumFractionDigits]]가 2이고 [[RoundingIncrement]]가 5이면 formatted number는 가장 가까운 0.05로 반올림된다("nickel rounding").
[[RoundingMode]]는 rounding mode이며, Table 29의 Identifier 열에 있는 String 값 중 하나이다.
[[TrailingZeroDisplay]]는 formatted number가 integer인 경우(즉, non-zero fraction digit를 가지지 않는 경우) trailing zero를 제거할지 여부를 나타내는 String 값 "auto" 또는 "stripIfInteger" 중 하나이다.
예시는 각 option의 고유한 동작을 설명하기 위한 것이다. ⬆️는 "양의 무한대 방향으로 resolve됨"을 의미하고, ⬇️는 "음의 무한대 방향으로 resolve됨"을 의미한다.
마지막으로, Intl.NumberFormat 인스턴스는 format accessor(16.3.3)가 반환하는 함수를 cache하는 [[BoundFormat]] 내부 슬롯을 가진다.
16.5 NumberFormat 객체를 위한 추상 연산
16.5.1 CurrencyDigits ( currency )
The implementation-defined abstract operation CurrencyDigits takes argument currency (String) and returns non-negative integer. It performs the following steps when called:
The abstract operation FormatNumericToString takes arguments intlObj (Object) and x (mathematical value 또는 negative-zero) and returns [[RoundedNumber]](mathematical value 또는 negative-zero) 및 [[FormattedString]](String) 필드를 가진 Record. intlObj의 내부 슬롯에 따라 x를 Intl mathematical value로 반올림한다. [[RoundedNumber]] 필드는 반올림된 결과 값을 포함하고, [[FormattedString]] 필드는 intlObj의 내부 슬롯에 따라 형식화된 그 결과의 String 값 표현을 포함한다. It performs the following steps when called:
Assert: intlObj는 [[RoundingMode]], [[RoundingType]], [[MinimumSignificantDigits]], [[MaximumSignificantDigits]], [[MinimumIntegerDigits]], [[MinimumFractionDigits]], [[MaximumFractionDigits]], [[RoundingIncrement]] 및 [[TrailingZeroDisplay]] 내부 슬롯을 가진다.
i가 not-found가 아니면 string을 string의 0부터 i까지의 substring으로 설정한다.
int를 result.[[IntegerDigitsCount]]로 둔다.
minIntDigits를 intlObj.[[MinimumIntegerDigits]]로 둔다.
int < minIntDigits이면,
forwardZeros를 code unit 0x0030 (DIGIT ZERO)이 minIntDigits - int번 나타나는 것으로 구성된 String으로 둔다.
string을 forwardZeros와 string의 문자열 연결로 설정한다.
sign이 negative이면,
x가 0이면 x를 negative-zero로 설정한다. 그렇지 않으면 x를 -x로 설정한다.
Record { [[RoundedNumber]]: x, [[FormattedString]]: string }를 반환한다.
16.5.4 PartitionNumberPattern ( numberFormat, x )
The abstract operation PartitionNumberPattern takes arguments numberFormat (NumberFormat으로 초기화된 object) and x (Intl mathematical value) and returns [[Type]](String) 및 [[Value]](String) 필드를 가진 Record의 List. numberFormat의 유효 locale 및 formatting options에 따라 x의 mathematical value를 나타내는 parts를 생성한다. It performs the following steps when called:
Record { [[Type]]: "plusSign", [[Value]]: plusSignSymbol }를 result에 append한다.
그렇지 않고 partType이 "minusSign"이면,
minusSignSymbol을 minus sign을 나타내는 ILND String으로 둔다.
Record { [[Type]]: "minusSign", [[Value]]: minusSignSymbol }를 result에 append한다.
그렇지 않고 partType이 "percentSign"이고 numberFormat.[[Style]]이 "percent"이면,
percentSignSymbol을 percent sign을 나타내는 ILND String으로 둔다.
Record { [[Type]]: "percentSign", [[Value]]: percentSignSymbol }를 result에 append한다.
그렇지 않고 partType이 "unitPrefix"이고 numberFormat.[[Style]]이 "unit"이면,
unit을 numberFormat.[[Unit]]으로 둔다.
unitDisplay를 numberFormat.[[UnitDisplay]]로 둔다.
unitString을 unitDisplay 형식에서 x 앞의 unit을 나타내는 ILD String 값으로 둔다. 이는 서로 다른 plural form을 가진 언어에서 x에 의존할 수 있다.
Record { [[Type]]: "unit", [[Value]]: unitString }를 result에 append한다.
그렇지 않고 partType이 "unitSuffix"이고 numberFormat.[[Style]]이 "unit"이면,
unit을 numberFormat.[[Unit]]으로 둔다.
unitDisplay를 numberFormat.[[UnitDisplay]]로 둔다.
unitString을 unitDisplay 형식에서 x 뒤의 unit을 나타내는 ILD String 값으로 둔다. 이는 서로 다른 plural form을 가진 언어에서 x에 의존할 수 있다.
Record { [[Type]]: "unit", [[Value]]: unitString }를 result에 append한다.
그렇지 않고 partType이 "currencyCode"이고 numberFormat.[[Style]]이 "currency"이면,
currency를 numberFormat.[[Currency]]로 둔다.
Record { [[Type]]: "currency", [[Value]]: currency }를 result에 append한다.
그렇지 않고 partType이 "currencyPrefix"이고 numberFormat.[[Style]]이 "currency"이면,
currency를 numberFormat.[[Currency]]로 둔다.
currencyDisplay를 numberFormat.[[CurrencyDisplay]]로 둔다.
currencyString을 currencyDisplay 형식에서 x 앞의 currency를 나타내는 ILD String 값으로 둔다. 이는 서로 다른 plural form을 가진 언어에서 x에 의존할 수 있다.
Record { [[Type]]: "currency", [[Value]]: currencyString }를 result에 append한다.
그렇지 않고 partType이 "currencySuffix"이고 numberFormat.[[Style]]이 "currency"이면,
currency를 numberFormat.[[Currency]]로 둔다.
currencyDisplay를 numberFormat.[[CurrencyDisplay]]로 둔다.
currencyString을 currencyDisplay 형식에서 x 뒤의 currency를 나타내는 ILD String 값으로 둔다. 이는 서로 다른 plural form을 가진 언어에서 x에 의존할 수 있다. 구현이 currency의 그러한 표현을 가지지 않으면 currency 자체를 사용한다.
Record { [[Type]]: "currency", [[Value]]: currencyString }를 result에 append한다.
The abstract operation PartitionNotationSubPattern takes arguments numberFormat (Intl.NumberFormat), x (Intl mathematical value), formattedString (String), and exponent (정수) and returns [[Type]](String) 및 [[Value]](String) 필드를 가진 Record의 List.
x는 rounding이 적용된 후의 Intl mathematical value이고 formattedString은 중간 formatted string이다.
numberFormat의 유효 locale 및 formatting options에 따라 number 및 notation에 대응하는 parts를 생성한다.
It performs the following steps when called:
Record { [[Type]]: "group", [[Value]]: groupSepSymbol }를 result에 append한다.
fractionDigits가 undefined가 아니면,
decimalSepSymbol을 decimal separator를 나타내는 ILND String으로 둔다.
Record { [[Type]]: "decimal", [[Value]]: decimalSepSymbol }를 result에 append한다.
Record { [[Type]]: "fraction", [[Value]]: fractionDigits }를 result에 append한다.
그렇지 않고 partType이 "compactSymbol"이면,
compactSymbol을 short form에서 exponent를 나타내는 ILD string으로 둔다. 이는 서로 다른 plural form을 가진 언어에서 x에 의존할 수 있다. 구현은 이 string을 제공할 수 있어야 하며, 그렇지 않으면 pattern에 "{compactSymbol}" placeholder가 없었을 것이다.
Record { [[Type]]: "compact", [[Value]]: compactSymbol }를 result에 append한다.
그렇지 않고 partType이 "compactName"이면,
compactName을 long form에서 exponent를 나타내는 ILD string으로 둔다. 이는 서로 다른 plural form을 가진 언어에서 x에 의존할 수 있다. 구현은 이 string을 제공할 수 있어야 하며, 그렇지 않으면 pattern에 "{compactName}" placeholder가 없었을 것이다.
Record { [[Type]]: "compact", [[Value]]: compactName }를 result에 append한다.
그렇지 않고 partType이 "scientificSeparator"이면,
scientificSeparator를 exponent separator를 나타내는 ILND String으로 둔다.
Record { [[Type]]: "exponentSeparator", [[Value]]: scientificSeparator }를 result에 append한다.
그렇지 않고 partType이 "scientificExponent"이면,
exponent < 0이면,
minusSignSymbol을 minus sign을 나타내는 ILND String으로 둔다.
Record { [[Type]]: "exponentMinusSign", [[Value]]: minusSignSymbol }를 result에 append한다.
exponent를 -exponent로 둔다.
exponentResult를 ToRawFixed(exponent, 0, 0, 1, undefined)로 둔다.
Record { [[Type]]: "exponentInteger", [[Value]]: exponentResult.[[FormattedString]] }를 result에 append한다.
계산은 numberFormat의 유효 locale 또는 numberFormat의 유효 locale 및 numbering system에 의존하는 numeric string 안의 location 및 ILD와 ILND String 값에 의존한다. 언급된 ILD 및 ILND String 값은 currency name에 대한 것을 제외하고, Unicode Standard에 명시된 General Category "Number, decimal digit"의 code point를 포함해서는 안 된다.
The abstract operation FormatNumeric takes arguments numberFormat (Intl.NumberFormat) and x (Intl mathematical value) and returns String. It performs the following steps when called:
parts의 각 Record { [[Type]], [[Value]] } part에 대해, 다음을 수행한다.
result를 result와 part.[[Value]]의 문자열 연결로 설정한다.
result를 반환한다.
16.5.7 FormatNumericToParts ( numberFormat, x )
The abstract operation FormatNumericToParts takes arguments numberFormat (Intl.NumberFormat) and x (Intl mathematical value) and returns Array. It performs the following steps when called:
The abstract operation UnwrapNumberFormat takes argument nf (ECMAScript 언어 값) and returns ECMAScript 언어 값을 포함하는 정상 완료 또는 throw 완료.
input object의 NumberFormat 인스턴스를 반환한다. 이는 값 자체이거나 4.3 Note 1의 규범적 선택 사항 constructor mode에 따라 %Intl.NumberFormat%에 의해 연결된 값이다.
It performs the following steps when called:
16.5.11 GetNumberFormatPattern ( numberFormat, x )
The abstract operation GetNumberFormatPattern takes arguments numberFormat (Intl.NumberFormat) and x (Intl mathematical value) and returns String.
number format object 안의 resolved unit-related options와 형식화되는 최종 scaled 및 rounded number(Intl mathematical value)를 함께 고려하고, 16.2.3에 설명된 String 값인 pattern을 반환한다.
It performs the following steps when called:
resolvedLocaleData를 numberFormat.[[LocaleData]]로 둔다.
The abstract operation GetNotationSubPattern takes arguments numberFormat (Intl.NumberFormat) and exponent (정수) and returns String.
resolved notation과 exponent를 고려하고, 16.2.3에 설명된 notation sub pattern의 String 값을 반환한다.
It performs the following steps when called:
resolvedLocaleData를 numberFormat.[[LocaleData]]로 둔다.
notationSubPatterns를 resolvedLocaleData.[[notationSubPatterns]]로 둔다.
compactDisplay를 numberFormat.[[CompactDisplay]]로 둔다.
compactPatterns를 notationSubPatterns.[[compact]].[[<compactDisplay>]]로 둔다.
compactPatterns.[[<exponent>]]를 반환한다.
그렇지 않으면,
"{number}"를 반환한다.
16.5.13 ComputeExponent ( numberFormat, x )
The abstract operation ComputeExponent takes arguments numberFormat (Intl.NumberFormat) and x (mathematical value) and returns 정수.
number formatting settings에 따라 x를 scale할 exponent(power of ten)를 계산한다.
이는 999가 1000으로 반올림되어 다른 exponent가 필요한 경우를 처리한다.
It performs the following steps when called:
The abstract operation ComputeExponentForMagnitude takes arguments numberFormat (Intl.NumberFormat) and magnitude (정수) and returns 정수.
locale 및 원하는 notation(scientific, engineering 또는 compact)에 따라 주어진 magnitude(most significant digit의 power of ten)를 가진 number를 scale할 exponent를 계산한다.
It performs the following steps when called:
The abstract operation ToIntlMathematicalValue takes argument value (ECMAScript 언어 값) and returns Intl mathematical value를 포함하는 정상 완료 또는 throw 완료.
value를 Intl mathematical value로 변환하여 반환한다. 이는 mathematical value와 positive-infinity, negative-infinity, not-a-number 및 negative-zero를 함께 포함한다.
이 추상 연산은 7.1.3과 유사하지만, exact decimal value를 나타낼 수 있도록 Number 또는 BigInt 대신 mathematical value를 반환할 수 있다.
It performs the following steps when called:
The abstract operation GetUnsignedRoundingMode takes arguments roundingMode (rounding mode) and sign (negative 또는 positive) and returns Table 31의 Unsigned Rounding Mode 열에서 온 specification type. number의 절댓값에 적용했을 때 roundingMode가 number의 signed value에 적용되었을 때와 같은 결과를 생성하는 rounding mode를 반환한다(sign이 negative이면 negative, 그렇지 않으면 positive). It performs the following steps when called:
Identifier 열의 값이 roundingMode이고 Sign 열의 값이 sign인 행에 대해, Table 31의 Unsigned Rounding Mode 열에 있는 specification type을 반환한다.
The abstract operation ApplyUnsignedRoundingMode takes arguments x (mathematical value), r1 (mathematical value), r2 (mathematical value), and unsignedRoundingMode (Table 31의 Unsigned Rounding Mode 열에서 온 specification type, 또는 undefined) and returns mathematical value. 아래쪽은 r1, 위쪽은 r2로 bracket된 x를 고려하고, unsignedRoundingMode에 따라 r1 또는 r2를 반환한다. It performs the following steps when called:
16.5.19 PartitionNumberRangePattern ( numberFormat, x, y )
The abstract operation PartitionNumberRangePattern takes arguments numberFormat (Intl.NumberFormat), x (Intl mathematical value), and y (Intl mathematical value) and returns [[Type]](String), [[Value]](String) 및 [[Source]](String) 필드를 가진 Record의 List를 포함하는 정상 완료 또는 throw 완료. x, y 및 numberFormat의 formatting options에 따라 localized number range의 parts를 생성한다. It performs the following steps when called:
x가 not-a-number 또는 y가 not-a-number이면 RangeError 예외를 던진다.
16.5.20 FormatApproximately ( numberFormat, result )
The abstract operation FormatApproximately takes arguments numberFormat (Intl.NumberFormat) and result ([[Type]](String) 및 [[Value]](String) 필드를 가진 Record의 List) and returns [[Type]](String) 및 [[Value]](String) 필드를 가진 Record의 List. PartitionNumberPattern에 설명된 Record 값의 List여야 하는 result를 수정하여 approximately sign에 대한 새 Record를 추가한다. 이는 numberFormat에 의존할 수 있다. It performs the following steps when called:
approximatelySign을 number가 approximate임을 나타내는 데 사용되는 ILND String 값으로 둔다.
approximatelySign이 비어 있지 않으면, Record { [[Type]]: "approximatelySign", [[Value]]: approximatelySign }를 result의 ILND index에 삽입한다. 예를 들어 numberFormat이 [[Locale]]"en-US", [[NumberingSystem]]"latn" 및 [[Style]]"decimal"을 가지면, 새 Record는 result의 첫 번째 요소 앞에 삽입될 수 있다.
result를 반환한다.
16.5.21 CollapseNumberRange ( numberFormat, result )
The implementation-defined abstract operation CollapseNumberRange takes arguments numberFormat (Intl.NumberFormat) and result ([[Type]](String), [[Value]](String) 및 [[Source]](String) 필드를 가진 Record의 List) and returns [[Type]](String), [[Value]](String) 및 [[Source]](String) 필드를 가진 Record의 List. result(PartitionNumberRangePattern 안에서 구성된 Record의 List여야 함)를 numberFormat의 유효 locale 및 formatting options에 따라 수정한다. redundant information을 제거하고, internal inconsistency를 resolve하며, 필요하면 character를 대체하고, 필요하면 spacing을 삽입한다. 그런 다음 결과 List를 반환한다. 알고리즘은 ILND이지만, CollapseNumberRange의 trivial implementation이 항상 result를 수정 없이 반환할 때 같은 인수 List에 대한 결과가 같지 않을 경우, Intl.NumberFormat.prototype.formatRange ( start, end )의 인수 List « start1, end1 »에 대한 결과가 인수 List « start2, end2 »에 대한 결과와 같아지게 하는 ambiguity를 도입해서는 안 된다.
예를 들어, 구현은 range separator 뒤의 currency symbol을 나타내는 Record를 제거하여 "$3–$5"를 나타내는 resultsList를 "$3–5"를 나타내는 List로 변환할 수 있다.
구현은 grammatical correctness를 위해 Record[[Value]] 필드를 수정할 수도 있다. 예를 들어 "0.5 miles–1 mile"을 나타내는 resultsList를 "0.5–1 miles"를 나타내는 List로 변환할 수 있다.
result를 수정 없이 반환하는 것은 CollapseNumberRange의 올바른 구현임이 보장된다.
16.5.22 FormatNumericRange ( numberFormat, x, y )
The abstract operation FormatNumericRange takes arguments numberFormat (Intl.NumberFormat), x (Intl mathematical value), and y (Intl mathematical value) and returns String을 포함하는 정상 완료 또는 throw 완료. It performs the following steps when called:
16.5.23 FormatNumericRangeToParts ( numberFormat, x, y )
The abstract operation FormatNumericRangeToParts takes arguments numberFormat (Intl.NumberFormat), x (Intl mathematical value), and y (Intl mathematical value) and returns Array를 포함하는 정상 완료 또는 throw 완료. It performs the following steps when called:
pluralCategories를 선택된 locale pr.[[Locale]]에 대해 PluralRuleSelect의 가능한 모든 결과를 포함하는 String의 List로 둔다. 이는 다음 순서에 따라 정렬된다: "zero", "one", "two", "few", "many", "other".
[[Locale]]은 plural rules가 사용하는 localization의 locale 언어 태그를 가진 String 값이다.
[[Type]]은 사용되는 plural rules를 식별하는 String 값 "cardinal" 또는 "ordinal" 중 하나이다.
[[Notation]]은 사용되는 notation을 식별하는 String 값 "standard", "scientific", "engineering" 또는 "compact" 중 하나이다.
[[CompactDisplay]]는 compact notation affix를 short form("5K") 또는 long form("5 thousand")으로 표시할지 지정하는 "short", "long" 또는 undefined 중 하나이며, 이는 경우에 따라 plural form 선택에 영향을 줄 수 있다. [[Notation]]이 "compact" 이외의 값을 가질 때 그리고 그때에만 undefined이다.
[[MinimumIntegerDigits]]는 사용할 최소 integer digits를 나타내는 non-negative integer이다.
[[MinimumFractionDigits]] 및 [[MaximumFractionDigits]]는 사용할 최소 및 최대 fraction digits를 나타내는 non-negative integer이다. 필요하면 number는 반올림되거나 trailing zero로 padding된다.
[[MinimumSignificantDigits]] 및 [[MaximumSignificantDigits]]는 사용할 최소 및 최대 fraction digits를 나타내는 positive integer이다. 이러한 속성은 없거나 둘 다 존재한다. 존재하면 minimum 및 maximum integer와 fraction digits를 override한다.
[[RoundingType]]은 어떤 rounding strategy를 사용할지 나타내는 fraction-digits, significant-digits, more-precision 또는 less-precision 중 하나의 값이며, 16.4에서 논의된 바와 같다.
[[ComputedRoundingPriority]]는 String 값 "auto", "morePrecision" 또는 "lessPrecision" 중 하나이다. 이는 [[RoundingType]]을 유효한 "roundingPriority" option으로 다시 변환하기 위해 17.3.2에서만 사용된다.
[[RoundingIncrement]]는 10, 100, 1000 또는 10000을 tenths, fifths, quarters 또는 halves로 균등하게 나누는 정수이다. 이는 계산된 rounding magnitude를 기준으로 rounding이 이루어져야 하는 increment를 나타낸다. 예를 들어 [[MaximumFractionDigits]]가 2이고 [[RoundingIncrement]]가 5이면 formatted number는 가장 가까운 0.05로 반올림된다("nickel rounding").
[[TrailingZeroDisplay]]는 formatted number가 integer인 경우(즉, non-zero fraction digit를 가지지 않는 경우) trailing zero를 제거할지 여부를 나타내는 String 값 "auto" 또는 "stripIfInteger" 중 하나이다.
The implementation-defined abstract operation PluralRuleSelect takes arguments locale (language tag), type ("cardinal" 또는 "ordinal"), notation (String), compactDisplay ("short" 또는 "long"), and decimalString (decimal String) and returns "zero", "one", "two", "few", "many" 또는 "other". 반환된 String은 대응하는 locale에 대해 type, notation 및 compactDisplay에 따라 decimalString의 plural category를 특징짓는다.
17.5.2 ResolvePlural ( pluralRules, n )
The abstract operation ResolvePlural takes arguments pluralRules (Intl.PluralRules) and n (Intl mathematical value) and returns [[PluralCategory]]("zero", "one", "two", "few", "many" 또는 "other") 및 [[FormattedString]](String) 필드를 가진 Record. 반환된 Record는 pluralRules의 유효 locale 및 내부 슬롯에 따라 n을 설명하는 두 string-valued 필드를 포함한다: [[PluralCategory]]는 그 plural category를 특징짓고, [[FormattedString]]은 그 formatted representation을 포함한다. It performs the following steps when called:
The implementation-defined abstract operation PluralRuleSelectRange takes arguments locale (language tag), type ("cardinal" 또는 "ordinal"), notation (String), compactDisplay ("short" 또는 "long"), xp ("zero", "one", "two", "few", "many" 또는 "other"), and yp ("zero", "one", "two", "few", "many" 또는 "other") and returns "zero", "one", "two", "few", "many" 또는 "other". 범위의 시작과 끝을 각각 특징짓는 plural category String 값 xp 및 yp를 대응하는 locale에 대해 type, notation 및 compactDisplay가 나타내는 범위 전체의 plural form에 대한 resolved String 값 또는 String 값 "other"로 매핑하는 구현 의존 알고리즘을 수행한다.
17.5.4 ResolvePluralRange ( pluralRules, x, y )
The abstract operation ResolvePluralRange takes arguments pluralRules (Intl.PluralRules), x (Intl mathematical value), and y (Intl mathematical value) and returns "zero", "one", "two", "few", "many" 또는 "other" 중 하나를 포함하는 정상 완료 또는 throw 완료. 반환된 String 값은 pluralRules의 유효 locale 및 내부 슬롯에 따라 x에서 시작하여 y에서 끝나는 범위의 plural form을 나타낸다. It performs the following steps when called:
x가 not-a-number 또는 y가 not-a-number이면 RangeError 예외를 던진다.
[[LocaleData]] 내부 슬롯의 값은 9.1에 설명된 제약 조건 및 다음 추가 제약 조건 내에서, 모든 locale 값 locale에 대해 구현 정의이다:
[[LocaleData]].[[<locale>]]는 "second", "minute", "hour", "day", "week", "month", "quarter", 그리고 "year" 필드를 가진다. 이전 이름들과 문자열 "-narrow" 또는 "-short"를 연결한 이름의 추가 필드가 존재할 수 있다. 이러한 필드에 대응하는 값은 다음 두 범주의 필드를 포함하는 Record이다:
"future" 및 "past" 필드. 이는 locale에 관련된 각 plural category에 대한 필드를 가진 Record이다. 해당 필드에 대응하는 값은 형식화된 숫자로 대체될 "{0}"을 포함할 수 있는 pattern이다.
선택적으로, key가 Number의 ToString 결과이고 값은 template으로 취급되지 않는 literal String인 추가 필드.
[[LocaleData]]의 어떤 locale 필드의 "nu" 필드 값인 List도 "native", "traditio", 또는 "finance" 값을 포함해서는 안 된다.
Note 2
구현은 Common Locale Data Repository(https://cldr.unicode.org/에서 이용 가능)가 제공하는 locale data를 사용하는 것이 권장된다.
18.3 Intl.RelativeTimeFormat 프로토타입 객체의 속성
Intl.RelativeTimeFormat 프로토타입 객체는:
%Intl.RelativeTimeFormat.prototype%이다.
일반 객체이다.
Intl.RelativeTimeFormat 인스턴스가 아니며 [[InitializedRelativeTimeFormat]] 내부 슬롯이나 Intl.RelativeTimeFormat 인스턴스 객체의 다른 내부 슬롯을 가지지 않는다.
[[PluralRules]]은 형식 지정에 사용되는 Intl.PluralRules 객체이다.
18.5 RelativeTimeFormat 객체를 위한 추상 연산
18.5.1 SingularRelativeTimeUnit ( unit )
The abstract operation SingularRelativeTimeUnit takes argument unit (String) and returns String을 포함하는 정상 완료 또는 throw 완료. It performs the following steps when called:
unit이 "seconds"이면, "second"를 반환한다.
unit이 "minutes"이면, "minute"를 반환한다.
unit이 "hours"이면, "hour"를 반환한다.
unit이 "days"이면, "day"를 반환한다.
unit이 "weeks"이면, "week"를 반환한다.
unit이 "months"이면, "month"를 반환한다.
unit이 "quarters"이면, "quarter"를 반환한다.
unit이 "years"이면, "year"를 반환한다.
unit이 "second", "minute", "hour", "day", "week", "month", "quarter", 또는 "year" 중 하나가 아니면, RangeError 예외를 던진다.
unit을 반환한다.
18.5.2 PartitionRelativeTimePattern ( relativeTimeFormat, value, unit )
The abstract operation PartitionRelativeTimePattern takes arguments relativeTimeFormat (Intl.RelativeTimeFormat), value (Number), and unit (String) and returns [[Type]](String), [[Value]](String), 그리고 [[Unit]](String 또는 empty) 필드를 가진 Records의 List를 포함하는 정상 완료, 또는 throw 완료. It performs the following steps when called:
The abstract operation MakePartsList takes arguments pattern (Pattern String), unit (String), and parts (형식화된 Number를 나타내는 Records의 List) and returns [[Type]](String), [[Value]](String), 그리고 [[Unit]](String 또는 empty) 필드를 가진 Records의 List. It performs the following steps when called:
이는 다음과 같은 Records의 List를 반환할 것이다.
«
{ [[Type]]: "literal", [[Value]]: "AA", [[Unit]]: empty},
{ [[Type]]: "integer", [[Value]]: "15", [[Unit]]: "hour"},
{ [[Type]]: "literal", [[Value]]: "BB", [[Unit]]: empty}
»
18.5.4 FormatRelativeTime ( relativeTimeFormat, value, unit )
The abstract operation FormatRelativeTime takes arguments relativeTimeFormat (Intl.RelativeTimeFormat), value (Number), and unit (String) and returns String을 포함하는 정상 완료 또는 throw 완료. It performs the following steps when called:
parts의 각 Record { [[Type]], [[Value]], [[Unit]] } part에 대해, 다음을 수행한다.
result를 result와 part.[[Value]]의 문자열 연결로 설정한다.
result를 반환한다.
18.5.5 FormatRelativeTimeToParts ( relativeTimeFormat, value, unit )
The abstract operation FormatRelativeTimeToParts takes arguments relativeTimeFormat (Intl.RelativeTimeFormat), value (Number), and unit (String) and returns Array를 포함하는 정상 완료 또는 throw 완료. It performs the following steps when called:
Intl.Segmenter.prototype.segment 메서드는 Intl.Segmenter 인스턴스에서 인수 string으로 호출되어, Intl.Segmenter 인스턴스의 locale 및 options를 사용해 해당 문자열에 대한 Segments 인스턴스를 생성한다. 다음 단계가 수행된다:
[[Locale]]은 segmentation에 사용되는 현지화의 locale에 대한 language tag를 가진 String 값이다.
[[SegmenterGranularity]]는 segment할 text element의 종류를 식별하는 String 값 "grapheme", "word", 또는 "sentence" 중 하나이다.
19.5 Segments 객체
Segments 인스턴스는 생성한 Intl.Segmenter 인스턴스의 locale 및 options에 따라, 특정 문자열의 segments를 나타내는 객체이다.
19.5.1 CreateSegmentsObject ( segmenter, string )
The abstract operation CreateSegmentsObject takes arguments segmenter (Intl.Segmenter) and string (String) and returns Segments 인스턴스. It performs the following steps when called:
internalSlotsList를 « [[SegmentsSegmenter]], [[SegmentsString]] »로 둔다.
19.5.2.1 %IntlSegmentsPrototype%.containing ( index )
containing 메서드는 Segments 인스턴스에서 인수 index로 호출되어, Segments 인스턴스를 생성한 Intl.Segmenter 인스턴스의 locale 및 options에 따라 지정된 index의 code unit을 포함하는 문자열 내 segment를 설명하는 Segment Data 객체를 반환한다. 다음 단계가 수행된다:
The abstract operation CreateSegmentIterator takes arguments segmenter (Intl.Segmenter) and string (String) and returns Segment Iterator. It performs the following steps when called:
internalSlotsList를 « [[IteratingSegmenter]], [[IteratedString]], [[IteratedStringNextSegmentCodeUnitIndex]] »로 둔다.
The abstract operation CreateSegmentDataObject takes arguments segmenter (Intl.Segmenter), string (String), startIndex (음이 아닌 정수), and endIndex (음이 아닌 정수) and returns Segment Data 객체. It performs the following steps when called:
segment가 "word-like"인지 여부는 구현 의존이며, 구현은 locale-sensitive tailorings를 사용하는 것이 권장된다. 일반적으로 공백 및/또는 구두점만으로 구성된 segments(예: ICU [International Components for Unicode, https://unicode-org.github.io/icu-docs/에 문서화됨]에서 "WORD_NONE" boundaries로 끝나는 것)는 "word-like"인 것으로 간주되지 않는다.
19.8 Segmenter 객체를 위한 추상 연산
19.8.1 FindBoundary ( segmenter, string, startIndex, direction )
The abstract operation FindBoundary takes arguments segmenter (Intl.Segmenter), string (String), startIndex (음이 아닌 정수), and direction (before 또는 after) and returns 음이 아닌 정수. It performs the following steps when called:
length를 string의 길이로 둔다.
단언: startIndex < length.
locale을 segmenter.[[Locale]]로 둔다.
granularity를 segmenter.[[SegmenterGranularity]]로 둔다.
direction이 before이면,
locale locale 및 text element granularity granularity를 사용하여, 시작부터 최대 startIndex code units가 앞서는 마지막 segmentation boundary를 string에서 검색한다.
boundary가 발견되면, 그 앞에 있는 string의 code units 수를 반환한다.
0을 반환한다.
단언: direction은 after이다.
locale locale 및 text element granularity granularity를 사용하여, index startIndex의 code unit 뒤에 오는 첫 번째 segmentation boundary를 string에서 검색한다.
boundary가 발견되면, 그 앞에 있는 string의 code units 수를 반환한다.
The abstract operation TransformCase takes arguments string (String), locales (ECMAScript 언어 값), and targetCase (lower 또는 upper). ECMA-262, 6.1.4에 설명된 것처럼 string을 UTF-16으로 인코딩된 code point의 시퀀스로 해석하고, targetCase로 ILD 변환한 결과를 새 String 값으로 반환한다. It performs the following steps when called:
availableLocales를 Unicode Character Database가 language-sensitive case mapping을 포함하는 언어 태그를 포함하는 Available Locales List로 둔다. 구현이 추가적인 locale-sensitive case mapping을 지원한다면, availableLocales는 그에 대응하는 언어 태그도 포함해야 한다.
Code point mapping은 Unicode Standard의 Default Case Conversion Algorithms의 tailored 버전에 따라 도출될 수 있다. 구현은 Unicode Character Database의 SpecialCasing.txt 파일 및/또는 CLDR 및/또는 다른 custom tailoring에 정의된 locale-sensitive tailoring을 사용할 수 있다. tailoring과 관계없이, conforming 구현의 case transformation 알고리즘은 동일한 입력 code point, locale 및 target case가 주어졌을 때 항상 동일한 결과를 산출해야 한다.
Note
일부 code point의 case mapping은 여러 code point를 생성할 수 있으므로, 결과는 입력과 같은 길이가 아닐 수 있다. toLocaleUpperCase와 toLocaleLowerCase 모두 context-sensitive 동작을 가지기 때문에, 두 함수는 대칭적이지 않다. 다시 말해, s.toLocaleUpperCase().toLocaleLowerCase()는 반드시 s.toLocaleLowerCase()와 같지 않으며, s.toLocaleLowerCase().toLocaleUpperCase()는 반드시 s.toLocaleUpperCase()와 같지 않다.
배열의 요소는 자신의 toLocaleString 메서드를 사용해 String으로 변환되고, 이러한 String들은 구현 정의 locale-sensitive separator String의 발생으로 구분되어 연결된다. 이 함수는 toString과 유사하지만, host environment의 현재 locale 관례에 대응하는 locale-sensitive 결과를 산출하도록 의도되었다.
Note 3
toLocaleString 함수는 의도적으로 generic이다. 이 함수는 자신의 this 값이 Array 객체일 것을 요구하지 않는다. 따라서 메서드로 사용하기 위해 다른 종류의 객체로 옮길 수 있다.
16.1 ECMA-402 8판에서 NumberFormat 생성자는 스타일이
"currency"이고 maximumFractionDigits가 해당 통화의 기본 소수 자릿수보다 낮게 설정된 경우 오류를 발생시켰습니다. 이 동작은 9판에서 수정되어 더 이상
오류를 발생시키지 않습니다.
Annex C (informative) 콜로폰
이 명세서는 GitHub에서 Ecmarkup라는 평문 소스 형식으로 작성되었습니다. Ecmarkup은 HTML과 Markdown 방언으로, 평문으로
ECMAScript 명세서를 작성하고, 이 문서의 편집 규칙을 따르는 완전한 HTML 렌더링으로 처리할 수 있는 프레임워크와 도구를 제공합니다. Ecmarkup은 Grammarkdown을 사용한 구문 정의와 Ecmarkdown을 사용한 알고리즘 단계 작성 등 여러 형식과 기술을 통합하여 구축되었습니다. 이 명세서의 PDF
렌더링은 CSS Paged Media 명세를 활용하는 인쇄 스타일시트를 사용하여 PrinceXML로 변환됩니다.
이전 판의 명세서는 Word로 작성되었습니다. 이 판의 기반이 된 Ecmarkup 소스 텍스트는 ECMAScript 2015 Word 문서를 자동 변환 도구로 Ecmarkup으로 변환하여 생성되었습니다.
By obtaining and/or copying this work, you (the licensee) agree that you have read, understood, and will comply with the following terms and conditions.
This document may be copied, published and distributed to others, and certain derivative works of it may be prepared, copied, published, and distributed, in whole or in part, provided that the above copyright notice and this Copyright License and Disclaimer are included on all such copies and derivative works. The only derivative works that are permissible under this Copyright License and Disclaimer are:
(i) works which incorporate all or portion of this document for the purpose of providing commentary or explanation (such as an annotated version of the document),
(ii) works which incorporate all or portion of this document for the purpose of incorporating features that provide accessibility,
(iii) translations of this document into languages other than English and into different formats and
(iv) works by making use of this specification in standard conformant products by implementing (e.g. by copy and paste wholly or partly) the functionality therein.
However, the content of this document itself may not be modified in any way, including by removing the copyright notice or references to Ecma International, except as required to translate it into languages other than English or into a different format.
The official version of an Ecma International document is the English language version on the Ecma International website. In the event of discrepancies between a translated version and the official version, the official version shall govern.
The limited permissions granted above are perpetual and will not be revoked by Ecma International or its successors or assigns.
This document and the information contained herein is provided on an “AS IS” basis and ECMA INTERNATIONAL DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY OWNERSHIP RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
Software License
All Software contained in this document ("Software") is protected by copyright and is being made available under the "BSD License", included below. This Software may be subject to third party rights (rights from parties other than Ecma International), including patent rights, and no licenses under such third party rights are granted under this license even if the third party concerned is a member of Ecma International. SEE THE ECMA CODE OF CONDUCT IN PATENT MATTERS AVAILABLE AT https://ecma-international.org/memento/codeofconduct.htm FOR INFORMATION REGARDING THE LICENSING OF PATENT CLAIMS THAT ARE REQUIRED TO IMPLEMENT ECMA INTERNATIONAL STANDARDS.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of the authors nor Ecma International may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE ECMA INTERNATIONAL "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ECMA INTERNATIONAL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.