Skip to content

Date and number formatting - #7

Merged
colemancda merged 6 commits into
masterfrom
feature/formatting
Nov 18, 2026
Merged

colemancda merged 6 commits into
masterfrom
feature/formatting

Conversation

@colemancda

Copy link
Copy Markdown
Member

Registers AppRuntime's new RuntimeFormatting (PureSwift/AppRuntime master): the LocaleInfo, NumberFormat and DateFormat contracts over Swift Foundation, shared by any host written in Swift. Foundation formats with ICU on Linux too, so guests don't link it.

  • HostApp.modules and the packager's HostContracts.modules add HostFormattingModule; a test checks that an app using the three contracts validates.
  • Plan.md: formatting moves from "later" to "in", with a note in §3 on the contracts this host registers as AppRuntime has them. README's LinuxHostApp row says so.

What RuntimeFormatting does about Linux:

  • The user's locale. Foundation on Linux ignores LANG and LC_ALL: Locale.current is always en_001. So RuntimeFormatting takes the user's locale from LC_ALL, else LANG, and the preferred languages from LANGUAGE. The time zone is TZ, else the system's.
  • Three gaps in Linux's Foundation:
    • there's no RelativeDateTimeFormatter, so relative dates use Date.AnchoredRelativeFormatStyle;
    • NumberFormatter loses integers past 2^53, so decimal integers use IntegerFormatStyle;
    • it groups the POSIX locale's digits, so the POSIX locale is left ungrouped on every platform.

Tests: RuntimeFormattingTests (16) pass on macOS and on Debian 13. Every suite here passes on Debian 13 in Docker.

@colemancda
colemancda merged commit 0d223da into master Nov 18, 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