Skip to content

Show day and month names in the locale's language - #19

Open
piotrkowski wants to merge 2 commits into
ianswope:masterfrom
piotrkowski:feat/locale-names
Open

piotrkowski wants to merge 2 commits into
ianswope:masterfrom
piotrkowski:feat/locale-names

Conversation

@piotrkowski

@piotrkowski piotrkowski commented Oct 11, 2026 •

Copy link
Copy Markdown

Part of #17. Builds on #18, so only the second commit is new here. Once #18 lands I'll rebase this onto master. It also touches the year view's month heading, which #15 moves, so whichever of the two lands second gets rebased as well.

Weekday headers, month titles and year-view month names now come from glib::DateTime::format, which follows LC_TIME. There's no new dependency. Month titles use %OB, the standalone month name, e.g. Polish październik rather than października.

Composite dates (day title, week range, tooltips, notifications) are unchanged. They also need locale-specific ordering and case, so I'll handle them separately.

pl_PL / de_DE / ru_RU:

pl_PL, de_DE, ru_RU

Checked with the four CI gates and gui_leaks.

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.
Weekday headers, month titles and the year view's month names came from
chrono's `%a` and `%B`, which only know English. They now come from
`glib::DateTime::format`, which follows LC_TIME, so there is still no new
dependency.

Month names use `%OB`, the form a month takes on its own, rather than `%B`,
the form it takes inside a date: Polish "październik" over a month, not
"października".

Full dates — the day view's title, the week's range, tooltips and
notifications — stay in English for now. They need each locale's order and
case as well as its words, which is a change of its own.
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