feat: localize condition text and forecast weekdays (--language) - #2
Open
KSxx wants to merge 2 commits into
Open
feat: localize condition text and forecast weekdays (--language)#2KSxx wants to merge 2 commits into
KSxx wants to merge 2 commits into
Conversation
Adds --language <en|de>, falling back to LC_MESSAGES then LANG, then English, per the design discussed in mryll#1. Translation lives in a new i18n.rs (plain match, no i18n crate) and is applied once, in icons::get_icon/get_icon_plain, so the Waybar tooltip and the structured JSON (and therefore the Omarchy panel) stay in sync the same way icon_set already does. Also localizes the daily forecast's weekday abbreviation (waybar.rs::short_day_name), which chrono's %a cannot do without the unstable-locales feature — a small fixed table in i18n.rs instead, same "no extra machinery" spirit as the condition strings. The Omarchy panel's own weekday label (Qt.formatDate "ddd") already follows the system locale, so no QML change was needed there. Per the thread on mryll#1: language is not added to manifest.json (that stays config-agnostic); the Omarchy panel reads it the same way it reads units, via setting("language", "") threaded through buildCmd(), set (if at all) directly in shell.json. i18n::every_condition_string_is_translated iterates icons::all_descriptions() so a WMO code added without a German entry fails the test suite instead of shipping untranslated. Closes mryll#1 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016CrAMuqtTnQDwanMruP69d
KSxx
force-pushed
the
i18n-condition-text
branch
from
September 3, 2026 05:54
c08596e to
31aa307
Compare
Same pattern as icon_set/palette: --language resolves once and is applied in icons::get_icon/get_icon_plain so both output surfaces stay in sync, language stays out of manifest.json, and the translation-coverage test is called out so a future WMO code doesn't ship untranslated by accident. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Lqfp2RQAo2tx3cvtw7DzKq
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1.
What
--language <en|de>, falling back toLC_MESSAGES→LANG→ English, per the design we settled on in Localize weather condition text (and forecast date formatting) #1.src/i18n.rs: a plainmatch, no i18n crate, matching the rest of the codebase's philosophy.icons::get_icon/get_icon_plain, so the Waybar tooltip and the structured JSON (and therefore the Omarchy panel) stay in sync — the same wayicon_setalready threads through both.waybar.rs::short_day_name), since chrono's%acan't do that without theunstable-localesfeature. Small fixed table ini18n.rsinstead — same reasoning as the condition strings, no new dependency. I checkedPanel.qml's own weekday label (Qt.formatDate "ddd"): it already follows the system locale on its own, so no QML change was needed there.languageis not inmanifest.json— the Omarchy panel reads it the same pathunitsalready takes,setting("language", "")threaded throughbuildCmd(), set (if at all) directly inshell.json.Coverage
i18n::every_condition_string_is_translatediteratesicons::all_descriptions()(the same tableicons.rsowns), so a new WMO code added later without a German entry fails the suite instead of shipping silently untranslated.structured::structured_output_is_localizedandwaybar::german_language_localizes_the_tooltipcheck both output surfaces end to end.Language::resolvehas its own coverage: flag-wins,LC_MESSAGESoverLANG, an expliciten*short-circuiting a laterde*variable, unknown/missing locale defaulting to English.--language de, withLANG=de_DE.UTF-8/LC_MESSAGES(no flag), on both--output jsonand the Waybar tooltip — condition text and weekday abbreviations (Do 03,Fr 04,Sa 05) all correct.cargo test,cargo clippy --all-targets,cargo fmt,qmllint omarchy/Panel.qmlall clean. The twotoo_many_argumentsclippy warnings onbuild_tooltip/build_outputpredate this PR (verified against master); this just adds one more argument to each.🤖 Generated with Claude Code