Skip to content

fix(hyprland/language): apply format-<lang> when base format omits {} - #5523

Open
serhatvs wants to merge 1 commit into
Alexays:masterfrom
serhatvs:fix/hyprland-language-format
Open

serhatvs wants to merge 1 commit into
Alexays:masterfrom
serhatvs:fix/hyprland-language-format

Conversation

@serhatvs

@serhatvs serhatvs commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Ensure format-<lang>, format-<lang>-<variant>, tooltip-format-<lang>, and tooltip-format-<lang>-<variant> take effect in hyprland/language even when format / tooltip-format does not use {}.

Previously, Language::update() always passed config_[propName].asString() as positional argument 0 to fmt::format(fmt::runtime(format_), ...). That only worked when format contained {}; setting a named fallback like "format": "{short}" (or "format": "Lang: {long}" from the first example in waybar-hyprland-language(5), or relying on tooltip-format's default "{long}") caused the per-language override to be silently ignored.

  • Format per-language overrides with the layout's named placeholders (falling back to the literal override string if it contains non-placeholder braces such as "{Español}").
  • Preserve wrapper substitution when format / tooltip-format contains an unescaped {} or {0...}, and otherwise return the formatted override directly.

Tests

  • Added Catch2 unit tests in test/hyprland/language.cpp covering #5295, man-page examples, wrapper formats, escaped braces, variant precedence, and tooltip overrides.
  • Extended test/smoke/ipc.sh with hyprland/language#override verifying fallback + format-de override transitions over AT-SPI.

Related issues
Closes #5295

Checklist

  • Code is formatted with clang-format
  • Builds locally (ninja -C build)
  • Man page updated for any new/changed user-facing option (man/)
  • Tested against the affected module(s)

Language::update() previously formatted format-<lang> and tooltip-format-<lang>
exclusively as positional argument 0 of format_ / tooltip_format. When format
was set to a named placeholder fallback such as "{short}" or "Lang: {long}"
(as in the first man-page example), or when tooltip-format used its default
"{long}", the per-language override was silently discarded.

Extract formatLanguage() into language_format.hpp:
- Format per-language overrides with the layout's named placeholders (keeping
  literal strings with non-placeholder braces intact).
- Substitute into baseFormat when it contains an unescaped "{}" / "{0}"
  positional placeholder, and otherwise return the formatted override directly.
- Add Catch2 unit tests (test/hyprland/language.cpp) and extend the Hyprland
  IPC smoke test (test/smoke/ipc.sh).
@serhatvs
serhatvs force-pushed the fix/hyprland-language-format branch from d22691b to 4caeecf Compare November 24, 2026 22:16
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.

hyprland/language Module does not use language specific format when Default format is set

1 participant