Skip to content

Start the week on the locale's first weekday - #18

Open
piotrkowski wants to merge 1 commit into
ianswope:masterfrom
piotrkowski:feat/locale-week-start
Open

piotrkowski wants to merge 1 commit into
ianswope:masterfrom
piotrkowski:feat/locale-week-start

Conversation

@piotrkowski

@piotrkowski piotrkowski commented Oct 11, 2026 •

Copy link
Copy Markdown

Part of #17.

The week now starts on the locale's first weekday instead of always on Sunday. Sunday remains the fallback.

GLib and GTK have no API for this, so locale.rs reads glibc's nl_langinfo directly, the same way GtkCalendar does. There's no new dependency. On non-glibc targets it returns None. week_start, week_dates and month_grid follow the value, and the weekday labels rotate to match.

en_US / de_DE / ar_EG:

en_US, de_DE, ar_EG

Checked with the four CI gates. #19 builds on this.

The week always started on Sunday, a constant in date_util.rs, which is not
where most of the world starts it. It now starts on the locale's first
weekday.

Neither GLib nor GTK exposes that, so `locale.rs` asks glibc's
`nl_langinfo` for `_NL_TIME_WEEK_1STDAY` and `_NL_TIME_FIRST_WEEKDAY`, the
way GtkCalendar does, with no new dependency. Decoding the two values is a
pure function in date_util.rs with its own tests; the FFI around it is a
few lines. Startup records the result once, after GTK has called setlocale.
Off glibc, or on a value the decoding doesn't recognise, the week keeps
starting on Sunday.

`week_start`, `week_dates` and `month_grid` follow it, and the weekday
labels in month view and the year thumbnails rotate to match.
@piotrkowski
piotrkowski force-pushed the feat/locale-week-start branch from b577f7c to 90d3077 Compare October 11, 2026 19:01
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