omarchy icon indicating copy to clipboard operation
omarchy copied to clipboard

Bar clock always shows weekday/month names in English, ignoring system locale (LANG)

Open isaac30503 opened this issue 3 months ago • 1 comments

Title

Bar clock always shows weekday/month names in English, ignoring system locale (LANG)

Description

The bar clock widget (omarchy.clock) always renders weekday names (dddd/ddd) and month names (MMMM/MMM) in English, regardless of the system locale. Setting LANG/LC_TIME to a non-English locale (e.g. es_MX.UTF-8) correctly changes every other locale-aware value on the system, but the clock widget in the bar is unaffected.

This used to work correctly under the old waybar-based bar (pre-Quattro); it broke after the migration to the Quickshell-based omarchy-shell.

Steps to reproduce

  1. Set a non-English system locale, e.g.:
    localectl set-locale LANG=es_MX.UTF-8
    
    and reboot.
  2. Confirm the locale is applied system-wide:
    $ localectl status
    System Locale: LANG=es_MX.UTF-8
    $ systemctl --user show-environment | grep LANG
    LANG=es_MX.UTF-8
    
  3. Set the bar clock format to include a weekday/month token, e.g. dddd HH:mm (the default).
  4. Observe the bar: it shows Saturday 14:05 instead of the expected sábado 14:05.

Root cause

BarWidget.qml for the clock plugin formats the date with the QML global function Qt.formatDateTime(date, format):

https://github.com/basecamp/omarchy/blob/master/shell/plugins/panels/clock/BarWidget.qml

function formatted(date) {
  return Qt.formatDateTime(date, activeFormat.replace(/ww/g, Model.isoWeekLiteral(date.getFullYear(), date.getMonth(), date.getDate())))
}

The two-argument Qt.formatDateTime(date, format) overload does not use the application's default locale for textual tokens (dddd, ddd, MMMM, MMM) — it always formats those using English/C-locale names, independent of Qt.locale() or the process environment.

I confirmed this directly against the running quickshell binary (Quickshell 0.3.0) with LANG=es_MX.UTF-8 LC_ALL=es_MX.UTF-8:

Qt.locale().name:                         es_MX
Qt.formatDateTime(d, "dddd d MMMM"):      Saturday 15 August      ← wrong
d.toLocaleString(Qt.locale(), "dddd HH:mm"): sábado 14:05         ← correct

So Qt.locale() correctly resolves to es_MX (the system/env locale is picked up fine), but Qt.formatDateTime() simply doesn't consult it for weekday/month names. Date.prototype.toLocaleString(locale, format) (and toLocaleDateString/toLocaleTimeString), by contrast, do honor the passed-in QLocale and render the correct localized names, while still supporting the same format-token syntax (including the custom ww week-number substitution already done by Model.isoWeekLiteral).

Suggested fix

Swap the formatting call in formatted() to a locale-aware one:

function formatted(date) {
  return date.toLocaleString(Qt.locale(), activeFormat.replace(/ww/g, Model.isoWeekLiteral(date.getFullYear(), date.getMonth(), date.getDate())))
}

I applied exactly this one-line change locally and confirmed the bar clock now renders correctly in Spanish (sáb 15 ago 01:47 instead of Sat 15 Aug 01:47) after an omarchy-restart-shell. No other format tokens (vertical format, 'W'ww week literal, AM/PM) regressed in my testing.

I didn't find any other use of Qt.formatDateTime elsewhere in shell/, so this appears to be the only spot affected.

Environment

  • Omarchy: 4.0.0-1
  • quickshell-git: 0.3.0.r20.g28771c7-1
  • Hyprland: 0.56.2-1
  • Locale: LANG=es_MX.UTF-8

isaac30503 avatar Aug 15 '26 07:08 isaac30503

Not planning this, and closing with the reasoning rather than leaving it to sit.

You diagnosed it correctly — Qt.formatDateTime does render dddd/MMMM from the C locale whatever Qt.locale() says, which is why the bar clock stays English. And you were right that it disagreed with the calendar popup, which was localizing.

The thing is that the rest of Omarchy is English too: menus, panels, notifications, every other label in the shell. So localizing the clock alone would not have made the desktop consistent, it would have made the clock the one localized surface on an otherwise English system. The calendar popup was the accident, not the clock — it was the only place in the shell reading day names off the system locale.

So we have gone the other way in #6988 and made the calendar English as well. Where the week starts still follows your locale, since that is a regional convention rather than a translation, and it stays overridable through weekStartDay.

Proper system-wide translation is worth doing and is on the list, but it is a much bigger piece of work than one format call — it needs every user-facing string in the shell, the menu, and the command-line tools behind a translation layer. When that happens the clock will come along with it.

— 🤖 Claude, posting on behalf of @dhh

dhh avatar Aug 15 '26 15:08 dhh