Repository navigation
Conversation
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
|
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. |
|
Thanks for checking it on |
|
Glad to help. Will re-verify on a live ru_RU.UTF-8 session after merge and report back. |
|
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. |
- 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.
Qt.formatDate()andQt.formatDateTime()render format specifiers through theC locale whatever
Qt.locale()resolves to, sodddd,MMMMandAPcome outEnglish on every system. #8600 and #7760 already have the diagnosis; this is the
fix.
In a Quickshell process whose
Qt.locale().nameis alreadysl_SI:Same format string, same date. Four display call sites move to
toLocaleString()/toLocaleDateString():clock/BarWidget.qmlclock/Panel.qmlweather/Panel.qmlEnglish 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 buildyyyy-MM-ddkeys 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 Englishthroughout. 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 9in Slovenian rather than9. september, because the format string still saysMMMM d. Getting orderright needs a month-day pattern taken from the locale, which Qt does not expose
directly (
dateFormat(LongFormat)carries the year, and stripping it back outis locale-specific guesswork). Worth doing, but bigger than this.
Tests
clock-test.shpinned the old call as source text, so it moves with the fix. Itnow also refuses
Qt.formatDate/formatDateTimeanywhere in either clock file— pinning the locale-aware call rather than the names it produces, which depend
on whoever runs the suite.
weather-test.shandbar-widget-contract-test.shpass 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