Skip to content

Read day and month names from the system locale - #10955

Closed
sbelcl wants to merge 1 commit into
omacom:quattrofrom
sbelcl:clock-locale
Closed

sbelcl wants to merge 1 commit into
omacom:quattrofrom
sbelcl:clock-locale

Conversation

@sbelcl

@sbelcl sbelcl commented Sep 9, 2026

Copy link
Copy Markdown

Qt.formatDate() and Qt.formatDateTime() render format specifiers through the
C locale whatever Qt.locale() resolves to, so dddd, MMMM and AP come out
English on every system. #8600 and #7760 already have the diagnosis; this is the
fix.

In a Quickshell process whose Qt.locale().name is already sl_SI:

Qt.formatDateTime(d, "dddd HH:mm")           ->  Wednesday 12:40
d.toLocaleString(Qt.locale(), "dddd HH:mm")  ->  sreda 12:40

Same format string, same date. Four display call sites move to
toLocaleString() / toLocaleDateString():

file what
clock/BarWidget.qml the bar label
clock/Panel.qml the calendar hero, and the month footer
weather/Panel.qml the forecast day names

English output is unchanged, byte for byte, in all four. Verified by running
both locales through an isolated Quickshell instance.

Deliberately not touched

The weather panel's other Qt.formatDate() calls. They build yyyy-MM-dd
keys compared against forecast payloads. A locale has no business near those.

The calendar's weekday headers (#7211). Those are pinned to
Qt.locale("en_US") on purpose, with a comment saying the interface is English
throughout. That is a decision, not this bug, and it is independent of these
four lines whichever way it goes — which is why this closes the other three and
leaves #7211 open.

Date order. The hero reads september 9 in Slovenian rather than
9. september, because the format string still says MMMM d. Getting order
right needs a month-day pattern taken from the locale, which Qt does not expose
directly (dateFormat(LongFormat) carries the year, and stripping it back out
is locale-specific guesswork). Worth doing, but bigger than this.

Tests

clock-test.sh pinned the old call as source text, so it moves with the fix. It
now also refuses Qt.formatDate/formatDateTime anywhere in either clock file
— pinning the locale-aware call rather than the names it produces, which depend
on whoever runs the suite. weather-test.sh and bar-widget-contract-test.sh
pass unchanged.

Relationship to the localization work

None. #7284 and #8765 would fix this as a side effect, but these four lines do
not need a framework and do not prejudge which one lands.

🤖 Generated with Claude Code

https://claude.ai/code/session_01JMv63sA2aQLdMTiF2MF5LB

Qt.formatDate() and Qt.formatDateTime() render format specifiers
through the C locale whatever Qt.locale() resolves to, so "dddd",
"MMMM" and "AP" come out English on every system. In a Quickshell
process whose Qt.locale().name is already sl_SI:

  Qt.formatDateTime(d, "dddd HH:mm")          -> "Wednesday 12:40"
  d.toLocaleString(Qt.locale(), "dddd HH:mm") -> "sreda 12:40"

Same format string, same date. toLocaleString() and
toLocaleDateString() take the locale, so the fix is to route the four
display calls through them:

  clock/BarWidget.qml   the bar label
  clock/Panel.qml       the calendar hero and the month footer
  weather/Panel.qml     the forecast day names

The weather panel's other Qt.formatDate() calls are left alone on
purpose: they build "yyyy-MM-dd" keys that are compared against
forecast payloads, and a locale has no business anywhere near those.

Not touched here: the calendar's weekday headers, which are pinned to
Qt.locale("en_US") deliberately, with a comment saying the interface is
English throughout. That is a decision rather than this bug, and
whichever way it goes it is independent of these four lines.

Also left alone: date order. The hero reads "september 9" in Slovenian
rather than "9. september", because the format string still says
"MMMM d". Ordering needs a month-day pattern taken from the locale,
which Qt does not expose directly, and that is a bigger change than
this one.

English output is unchanged, byte for byte, in every one of these.

Closes omacom#7481
Closes omacom#7760
Closes omacom#8600

The clock test pinned the old call as source text, so it moves with the
fix, and now also refuses Qt.formatDate/formatDateTime anywhere in
either clock file -- pinning the locale-aware call rather than the
names it produces, which depend on whoever runs the suite.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JMv63sA2aQLdMTiF2MF5LB
@WokoFlipper

Copy link
Copy Markdown

Confirming the bug on ru_RU.UTF-8 (LANG=ru_RU.UTF-8): Qt.formatDateTime(d, "dddd HH:mm") renders Wednesday where d.toLocaleString(Qt.locale(), ...) renders the Russian weekday. Backing this fix — the four display call sites are exactly what a Russian desktop needs, independent of which i18n framework (#8765 vs #10051) lands.

@sbelcl

sbelcl commented Sep 14, 2026

Copy link
Copy Markdown
Author

Thanks for checking it on ru_RU.UTF-8 — that is exactly the confirmation this
needed, and on a different script. Two locales, the same four call sites, and
neither needs a framework to get its dates right.

@WokoFlipper

Copy link
Copy Markdown

Glad to help. Will re-verify on a live ru_RU.UTF-8 session after merge and report back.

@bjarneo

bjarneo commented Sep 21, 2026

Copy link
Copy Markdown
Member

Automated duplication check: this pull request looks similar to #7173, which covers the same clock locale names. I keep that one open and close this one to consolidate review.

If you feel this is the wrong decision, please open the PR again with a note on the difference.

@bjarneo bjarneo closed this Sep 21, 2026
yatstudio added a commit to yatstudio/omarchy that referenced this pull request Oct 14, 2026
- Add ZhCN.isSimplified() keyed on script/region (zh, zh_CN, zh_SG, zh_Hans)
  so zh_TW/zh_HK/zh_MO/zh_Hant no longer get Simplified Chinese.
- Revert clock Panel.qml labelLocale change; leave it to omacom#10955.
- Update docs/chinese-ui.md to document the Simplified-only behavior.
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.

3 participants