Repository navigation
Conversation
Qt.formatDateTime renders dddd and MMMM from the C locale whatever Qt.locale() says, so the clock stayed English while its own calendar popup, which already goes through Qt.locale(), did not. All twelve shipped presets render identically under an English locale. Closes #6934 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Localizes bar clock weekday/month names using the active Qt locale.
Changes:
- Replaces
Qt.formatDateTimewith locale-awareDate.toLocaleString. - Preserves existing format and ISO-week substitution behavior.
Tip
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| return Qt.formatDateTime(date, activeFormat.replace(/ww/g, Model.isoWeekLiteral(date.getFullYear(), date.getMonth(), date.getDate()))) | ||
| // toLocaleString, not Qt.formatDateTime: the latter renders dddd/MMMM from | ||
| // the C locale regardless of Qt.locale(), so day and month names stay English. | ||
| return date.toLocaleString(Qt.locale(), activeFormat.replace(/ww/g, Model.isoWeekLiteral(date.getFullYear(), date.getMonth(), date.getDate()))) |
There was a problem hiding this comment.
Verified in the running UI. I did it in a throwaway VM rather than on a live desktop: installed Omarchy 3.8.0 from the ISO, upgraded it to Quattro, generated de_DE.UTF-8, patched the clock widget in /usr/share/omarchy, set LANG=de_DE.UTF-8 and restarted the shell.
Horizontal, short preset — Samstag 07:29, centred, no clipping, neighbouring widgets unaffected.
Then set the clock to a Thursday in December to hit the longest German names:
dddd HH:mm→Donnerstag 14:05(longest German weekday, 10 chars vs 9 for Wednesday)d MMMM 'W'ww yyyy→3 Dezember W49 2026
Vertical bar, dd\nMMM\n'W'ww\n''yy, stacks as 03 / Dez. / W49 / '26 — the abbreviated German month carries a trailing period and still fits the bar width.
No clipping, no layout shift, and the quoted literals survive toLocaleString in both orientations (W49, '26). Screenshots are on the run, happy to attach any of them if useful.
— 🤖 Claude, posting on behalf of @dhh
|
Closing — this went the wrong way. The shell is English throughout, and a real system-wide translation is a separate future project. Localizing the bar clock to match the calendar made the clock the odd one out; the calendar was the accident. Replaced by #6988, which takes the calendar's day names from Leaving #6934 open would be misleading, so closing that too with the reasoning. — 🤖 Claude, posting on behalf of @dhh |
Qt.formatDateTime(date, format)rendersdddd/ddd/MMMM/MMMfrom the C locale in Qt 6 regardless ofQt.locale(), so the bar clock stayed English whateverLANGsaid. The calendar popup already localizes throughQt.locale().dayName, so the bar and its own popup disagreed.date.toLocaleString(Qt.locale(), format)honours the locale and takes the same format string.Format equivalence
Checked all eight horizontal and four vertical presets from
Model.jsthrough both calls:'W'wwand''yyquoted literals and the embedded newlines.de_DEthe day and month names localize as expected.The one intended behavioral change is
AP, which now renders the locale's own designator instead of a hard-codedPM.Verified in the running UI
test/shell.d/clock-test.shis deliberately Qt-free, so this line is not unit-testable. Verified in a throwaway VM instead — Omarchy 3.8.0 installed from the ISO, upgraded to Quattro,de_DE.UTF-8generated,LANGset, shell restarted:dddd HH:mmSamstag 07:29dddd HH:mm(Thursday, worst-case weekday)Donnerstag 14:05d MMMM 'W'ww yyyy(December)3 Dezember W49 2026dd\nMMM\n'W'ww\n''yy(vertical bar)03/Dez./W49/'26No clipping, no layout shift, neighbouring widgets unaffected, and the quoted literals survive in both orientations.
Closes #6934
— 🤖 Claude, posting on behalf of @dhh