Clock: optional locale setting for day and month names - #9155
Open
synjan wants to merge 2 commits into
Open
Conversation
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
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.
What
Adds an opt-in
localesetting 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 thatQLocale; when unset nothing changes — the bar still goes throughQt.formatDateTimeand the calendar keepsQt.locale("en_US").Model.js:localeName()normalises the setting (nb-NO.UTF-8→nb_NO; blank/C/POSIX→ unset),heroDateFormat()picks the hero date's order from the locale's own short date format.BarWidget.qml:formatted()usesdate.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, soddd d. MMMreadstir 30. augrather thantir. 30. aug.; the ordinal from the format string is untouched.Panel.qml:labelLocalefollows the setting; the hero date becomes25. august/25 August/August 25by locale; short weekday headings drop a trailing period (man.→MAN).manifest.json: declares the setting indefaultsandschemaso it shows up in settings.Why
Qt.formatDateTimewith a format string always renders English names, so a Norwegian (or German, or French) desktop getsTuesday 25. Augin the bar and an English calendar no matter whatLC_TIMEsays. 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
localein shell.json: bar and calendar identical to before (checked against 4.0.1 output fordddd HH:mm,d MMMM 'W'ww yyyy, heroMMMM d).omarchy bar set omarchy.clock locale nb_NO: bartirsdag 14:30(dddd HH:mm) /tir 25. aug 14:30(ddd d. MMM HH:mm), calendar hero25. august, headingsMAN TIR ONS …, month lineAUGUST 2026.locale: en_USexplicitly: identical to unset (Tuesday 14:30, heroAugust 25).locale: de_DE:Dienstag 14:30/Di 25. Aug 14:30, hero25. August, headingMO.en_GB: hero25 August.qml6script overQt.locale(name); the unset column withQt.formatDateTime/Qt.formatDateon the same date.node -echecks onlocaleName/heroDateFormatforM/d/yy,dd.MM.yyyy,dd/MM/yyyy,yyyy-MM-dd.🤖 Generated with Claude Code
https://claude.ai/code/session_01X2vGBcjauThiQrttbet9ZB