GocciaScript differences: Locale data comes from ICU: the system's library, or on WebAssembly the ICU linked into the module with the data file its host offers. Without ICU, numbers, dates, lists and display names format without locale data and collation compares code units; an embedded CLDR resource still answers locale aliases, plural categories, relative time patterns, a currency's default digits and parts of Intl.Locale's information.
Executive Summary
ECMA-402 conformance -- Implements the Internationalization API with locale-aware formatting for numbers, dates, lists, durations, and relative time
Data strategy -- ICU for formatting, collation and segmentation; an embedded CLDR resource for locale aliases, plural categories, relative time patterns, currency digits and parts of Intl.Locale's information
Locale negotiation -- BCP 47 locale identifiers with Unicode extension keys, best-fit and lookup matching algorithms
Segmentation -- Intl.Segmenter provides Unicode-aware grapheme, word, and sentence segmentation
Collation and display -- Intl.Collator for locale-sensitive string comparison, Intl.DisplayNames for localized display of language, region, and script names
Data Strategy
Intl takes its locale data from ICU: the system's library, ICU's own build on Windows, or on WebAssembly the ICU
linked into the module (WebAssembly — ICU). There is no other source of number, date, list or
display-name formatting, collation, or likely subtags: without ICU, new Intl.NumberFormat("de-DE").format(1234567.891) gives 1234567.891,
Intl.DateTimeFormat formats a date as Date.prototype.toString does, Intl.Collator compares code units and
new Intl.Locale("zh").maximize() stays zh.
An embedded CLDR resource answers, with or without ICU, locale aliases (iw becomes he), the plural categories
Intl.PluralRules reports, the patterns Intl.RelativeTimeFormat fills, a currency's default number of digits, and
parts of Intl.Locale's information, such as its hour cycles (source/engine/Goccia.Intl.pas).
Platform ICU details
Platform
Library
Notes
macOS
libicucore
Ships with the OS; available on all supported macOS versions
Linux
libicui18n
Typically provided by the libicu or icu system package
Windows
icuin79.dll, icuuc79.dll, icudt79.dll
ICU's own build, shipped beside the executables (ADR 0189); the system icu.dll (Windows 10 1903+) is the fallback
WebAssembly (wasm32-wasip1)
ICU 79.1 linked into the module, data in icudt79l.dat
The host offers the data file at /.goccia/icu; it holds 22 locales; another is not supported, so locale matching falls back to the default locale (ADR 0245)
On Windows, GocciaScript loads the newest icuin<major>.dll and icuuc<major>.dll (major 70 or later) found beside the executable or on PATH, and falls back to the system's icu.dll. Windows' icu.dll exports only part of ICU's C API: without udtitvfmt_formatCalendarToResult, formatRange cannot keep the proleptic Gregorian calendar before 1582. Release archives and CI builds for Windows carry ICU 79.1, fetched and checked by scripts/fetch-windows-icu.sh, with ICU's license as ICU-LICENSE.txt.
Intl.supportedValuesOf("currency") lists the currencies Intl.DisplayNames names in the loaded data (ECMA-402 §6.4 AvailableCanonicalCurrencies), so it follows the ICU in use: ICU 79 no longer names CNX, for example.
The embedded CLDR data is generated from upstream CLDR JSON distributions and linked as a FreePascal .res resource. Define GOCCIA_INTL_NO_EMBEDDED_CLDR at compile time to omit it.
Return an array of supported values for a given key ("calendar", "collation", "currency", "numberingSystem", "timeZone", "unit")
Intl.Locale
Represents a Unicode locale identifier with parsed subtags and extension keys.
Constructor / Static
Description
new Intl.Locale(tag, options?)
Create from a BCP 47 language tag string with optional override options
Getter
Description
baseName
Base locale identifier without extension keys
calendar
Calendar type (Unicode ca extension)
caseFirst
Case-first sort order ("upper", "lower", "false")
collation
Collation type (Unicode co extension)
firstDayOfWeek
First day of the week (Unicode fw extension, "mon"…"sun"). The option accepts weekday names and the numbers 0–7; other values throw RangeError rather than being stringified (#1268)
hourCycle
Hour cycle ("h11", "h12", "h23", "h24")
language
Language subtag
numberingSystem
Numbering system (Unicode nu extension)
numeric
Whether numeric collation is enabled
region
Region subtag
script
Script subtag
variants
Variant subtags joined with - (e.g. "1996-fonipa"), or undefined
Return an array of format parts with type and value
formatRange(startDate, endDate)
Format a date range
formatRangeToParts(startDate, endDate)
Return an array of format parts for a date range
resolvedOptions()
Return an object reflecting the locale and formatting options
ICU 78 loads no abbreviated or wide month names and no era names for the iso8601 calendar (ICU-23262, fixed in ICU 79), so a date that should read January 1, 2020 AD comes out with blanks where the month and era go. When the loaded ICU lacks those names, GocciaScript formats every iso8601 date and range with ICU's Gregorian calendar data, as ICU 77 and earlier format iso8601. Names are then always present and format() and formatRange() agree; the cost is that on such an ICU, ICU's own iso8601 patterns such as 2020-01-02 for dateStyle: "short" give way to the Gregorian 1/2/20. resolvedOptions().calendar still reports iso8601, and the dates are the same in both calendars. GocciaScript checks the loaded library rather than its version, so ICU 77 and earlier, ICU 79, and an ICU 78 build with the fix applied keep their own iso8601 formatting.
Intl.PluralRules
Provides plural-sensitive formatting and plural category selection.