Skip to content

Clock: optional locale setting for day and month names - #9155

Open
synjan wants to merge 2 commits into
omacom:quattrofrom
synjan:clock-locale-setting
Open

Clock: optional locale setting for day and month names#9155
synjan wants to merge 2 commits into
omacom:quattrofrom
synjan:clock-locale-setting

Conversation

@synjan

@synjan synjan commented Aug 30, 2026

Copy link
Copy Markdown

What

Adds an opt-in locale setting to the clock bar widget. When set ("locale": "nb_NO", de_DE, …) the bar label and the calendar popup format day and month names through that QLocale; when unset nothing changes — the bar still goes through Qt.formatDateTime and the calendar keeps Qt.locale("en_US").

  • Model.js: localeName() normalises the setting (nb-NO.UTF-8nb_NO; blank/C/POSIX → unset), heroDateFormat() picks the hero date's order from the locale's own short date format.
  • BarWidget.qml: formatted() uses date.toLocaleString(locale, format) only when a locale is set.
  • BarWidget.qml/Model.js: short day and month names that the locale abbreviates with a period (tir., aug.) lose it in the bar label, so ddd d. MMM reads tir 30. aug rather than tir. 30. aug.; the ordinal from the format string is untouched.
  • Panel.qml: labelLocale follows the setting; the hero date becomes 25. august / 25 August / August 25 by locale; short weekday headings drop a trailing period (man.MAN).
  • manifest.json: declares the setting in defaults and schema so it shows up in settings.

Why

Qt.formatDateTime with a format string always renders English names, so a Norwegian (or German, or French) desktop gets Tuesday 25. Aug in the bar and an English calendar no matter what LC_TIME says. Reading the environment would change behaviour for everyone; a setting keeps the current English default and lets those who want their language ask for it.

Test

  • No locale in shell.json: bar and calendar identical to before (checked against 4.0.1 output for dddd HH:mm, d MMMM 'W'ww yyyy, hero MMMM d).
  • omarchy bar set omarchy.clock locale nb_NO: bar tirsdag 14:30 (dddd HH:mm) / tir 25. aug 14:30 (ddd d. MMM HH:mm), calendar hero 25. august, headings MAN TIR ONS …, month line AUGUST 2026.
  • locale: en_US explicitly: identical to unset (Tuesday 14:30, hero August 25). locale: de_DE: Dienstag 14:30 / Di 25. Aug 14:30, hero 25. August, heading MO. en_GB: hero 25 August.
  • The locale table above was produced with a small qml6 script over Qt.locale(name); the unset column with Qt.formatDateTime/Qt.formatDate on the same date.
  • node -e checks on localeName/heroDateFormat for M/d/yy, dd.MM.yyyy, dd/MM/yyyy, yyyy-MM-dd.

🤖 Generated with Claude Code

https://claude.ai/code/session_01X2vGBcjauThiQrttbet9ZB

synjan and others added 2 commits August 30, 2026 13:59
Qt formats day and month names in English whenever it is handed an
explicit format string, so the bar reads "Tuesday" whatever the system
is set to. A new "locale" bar-widget setting ("nb_NO", "de_DE", ...)
formats the label and the calendar through that QLocale instead. Unset
keeps today's behaviour exactly: Qt.formatDateTime in the bar, en_US in
the calendar.

With a locale set, the calendar's hero date follows the locale's own
short-date order ("25. august", "25 August", "August 25"), and short
weekday headings lose the trailing period some locales abbreviate with.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X2vGBcjauThiQrttbet9ZB
…n the bar

Locales such as nb_NO and de_DE abbreviate with a trailing period, which
next to the ordinal in "d." stacks up as "tir. 30. aug.". The short
names the locale itself reports lose their period in the bar label; the
ordinal from the format string is untouched. The calendar headings
already did this.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X2vGBcjauThiQrttbet9ZB
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