Skip to content

Add TextStyle and localized display names; print Locale as the JDK does - #23

Merged
yogthos merged 2 commits into
mainfrom
feat/text-style-display-names
Oct 27, 2026
Merged

yogthos merged 2 commits into
mainfrom
feat/text-style-display-names

Conversation

@yogthos

@yogthos yogthos commented Oct 26, 2026

Copy link
Copy Markdown
Member

Month/DayOfWeek getDisplayName(TextStyle, Locale) and ChronoField getDisplayName(Locale) answer in the locale, from tables measured on JDK 21 (NARROW, standalone forms, field names) registered on :date-names and a new :field-names point; needs jolt-lang/jolt#1439 for the lookups, and keeps working on an older jolt. TextStyle becomes an enum. Locale prints en_US like toString and gains toLanguageTag/getLanguage/getCountry; data is registered under both spellings so older jolts still find it. Also fixes the unescaped quotes in locale_data.clj's ns docstring. Suite: 122 tests pass on jolt#1439 and on the v0.8.23 release.

…K does

TextStyle is an enum with isStandalone, asStandalone and asNormal. The bundled
locales gain the NARROW and standalone month and day forms and the ChronoField
display names, measured from JDK 21, registered on :date-names and a new
:field-names point so Month, DayOfWeek and ChronoField getDisplayName answer in
the locale (a jolt whose points lack those fields keeps the four it had).

A Locale printed its id, "en-US"; it prints "en_US" now, as toString does, and
answers toLanguageTag, getLanguage and getCountry. Its data is registered under
both spellings, so a jolt that looks data up by the printed form still finds it.
locale_data.clj's ns docstring had unescaped quotes, which the JVM's reader
refuses.
yogthos added a commit to jolt-lang/jolt that referenced this pull request Oct 26, 2026
They ignored their style and locale: a month was its constant name, a field
its toString. Month and DayOfWeek now read the :date-names point by TextStyle
(the narrow and standalone tables are new optional fields, the narrow form
derived from the format name when a provider has none) and ChronoField a new
:field-names point, whose default is ROOT's six names. jolt-lang/time supplies
the other locales and TextStyle (jolt-lang/time#23).

Core finds a Locale's data by its rendering, and jolt-lang/time's Locale now
prints the JDK's en_US; SimpleDateFormat, String/format and the currency
lookup read it through one key that maps it back to the registered en-US.
A Locale was its id alone: forLanguageTag "zh-Hant-TW" printed zh_Hant_TW with
country Hant, und printed "und", and a variant was dropped. It is now
language, script, country and variant, printed and tagged as the JDK does
(zh_TW_#Hant, en_US_POSIX, de-CH-x-lvariant-x), with getScript, getVariant and
Locale/of.

jolt now narrows a lang-COUNTRY id to its language, so the countries whose
number symbols differ from their language's are listed (es-MX, de-AT, …), and
currency data covers every country of the bundled languages, each checked
against JDK 21's formatted output. de-CH's grouping separator is JDK 21's
U+2019, not an apostrophe. TextStyle names its own class, and is in
:jolt/provides so a lone reference loads the library.
@yogthos
yogthos merged commit 19bf6a7 into main Oct 27, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant