Repository navigation
Add TextStyle and localized display names; print Locale as the JDK does - #23
Merged
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.