Repository navigation
Start the week on the locale's first weekday - #18
Open
piotrkowski wants to merge 1 commit into
Open
piotrkowski wants to merge 1 commit into
piotrkowski wants to merge 1 commit into
Conversation
This was referenced Oct 11, 2026
piotrkowski
force-pushed
the
feat/locale-week-start
branch
from
October 11, 2026 18:36
75fe6c9 to
b577f7c
Compare
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
force-pushed
the
feat/locale-week-start
branch
from
October 11, 2026 19:01
b577f7c to
90d3077
Compare
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.
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.rsreads glibc'snl_langinfodirectly, the same way GtkCalendar does. There's no new dependency. On non-glibc targets it returnsNone.week_start,week_datesandmonth_gridfollow the value, and the weekday labels rotate to match.en_US/de_DE/ar_EG:Checked with the four CI gates. #19 builds on this.