Skip to content

Weather: respect LC_MEASUREMENT and LC_ALL for unit selection - #20224

Closed
grold wants to merge 1 commit into
omacom:quattrofrom
grold:weather-respect-lc-measurement
Closed

grold wants to merge 1 commit into
omacom:quattrofrom
grold:weather-respect-lc-measurement

Conversation

@grold

@grold grold commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Related to #17415 and #19570.

omarchy region formats (e.g. omarchy region formats en-IE) intentionally keeps LANG=en_US.UTF-8 for UI text and sets LC_MEASUREMENT (along with LC_TIME, LC_NUMERIC, LC_MONETARY, LC_PAPER) to the chosen region locale.

Previously, shell/plugins/panels/weather/Panel.qml passed Qt.locale().name to Model.shouldUseImperial(...). Because Qt.locale() follows LANG (en_US) rather than LC_MEASUREMENT (en_IE.UTF-8), the weather panel fell back to °F / mph whenever wttr.in had not supplied reportCountry.

Changes

  • Added Model.measurementLocale(lcAll, lcMeasurement, fallbackLocale) in shell/plugins/panels/weather/Model.js following POSIX precedence (LC_ALL → LC_MEASUREMENT → fallback system locale).
  • Updated shell/plugins/panels/weather/Panel.qml to pass Model.measurementLocale(Quickshell.env("LC_ALL"), Quickshell.env("LC_MEASUREMENT"), Qt.locale().name) into Model.shouldUseImperial(...).
  • Added regression coverage in test/shell.d/weather-units-test.sh.

Verification

  • bash test/shell.d/weather-units-test.sh passes (5/5 assertions).
  • Verified in the live shell (LANG=en_US.UTF-8, LC_MEASUREMENT=en_IE.UTF-8) that the weather panel now displays °C and km/h even without a wttr.in country response.

Assisted by Gemini 4 Hydrogen (Reasoning: Medium)

@greptile-apps

greptile-apps Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5 · The PR appears safe to merge.RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge.

Summary

The weather panel now uses LC_ALL, then LC_MEASUREMENT, then the system locale when it needs a locale to choose units.

  • The weather panel uses measurement settings for automatic units.

Reviews (1) · Last reviewed commit: "Respect LC_MEASUREMENT and LC_ALL for we..." · Reviewed by Greptile

@omarchybot omarchybot added bug Something isn't working verified Omarchy Triage has verified that this issue is ready for final review labels Nov 26, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

The locale fallback worked in a disposable Omarchy worker running this head, 5f1786a6a60fde7f930933a7a35b584cd9b806f0. I set LANG=en_US.UTF-8, ran omarchy region formats en-IE, pinned Dublin by coordinates, and made wttr.in unavailable. The base showed 44°F and 6 mph; this head showed 7°C and 9 km/h; restoring the base weather files brought Fahrenheit and mph back. With this head restored, LC_ALL=en_US.UTF-8 overrode Irish measurement settings as expected. These were the real panel and live Open-Meteo conditions, opened through shell IPC.

./test/cli passed all 143 assertions, and weather-units-test.sh passed all five through the worker's shell-test wrapper. GPT-6 High in Codex checked the diff, locale handoff, unit consumers and related proposals. Opus 5.5 High and muse-wonder via pi (thinking high) also found no code defect. Their source reviews agreed; independence is not guaranteed.

This fixes the measurement-locale fallback; it does not persist the configured location's country, so it does not fully resolve #17415. That separate behavior is covered by the existing country-persistence proposals. No code changes were needed in this review. The ready label was refused because GitHub has Tests and Check translation structure waiting for approval on this head. Local worker verification passed, but those workflows have not run. This is left verified, waiting for the maintainer to approve the workflow runs and for their results.

Before: base ignores Irish measurement formats and shows Fahrenheit and mph while wttr.in is unavailable

After: this head shows Celsius and km/h for the same Dublin conditions and region settings

@chessing234

Copy link
Copy Markdown
Contributor

your commit is in #21016. weather units still follow LC_MEASUREMENT, and LC_ALL still wins. the hero layout from #20226 is on the same panel. @dhh @omarchybot if 21016 lands, this can close as superseded.

@emirb

emirb commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Closed in #17443

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working verified Omarchy Triage has verified that this issue is ready for final review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants