Skip to main content

Module keystroke_format

Module keystroke_format 

Source
Expand description

Platform- and locale-aware formatting for [KeyStroke]s.

  • On macOS, the returned string uses the traditional symbol modifiers (⌘⇧⌥⌃) and Unicode key glyphs (↑↩⇥ …). These symbols are universal — no locale lookup needed.
  • On Windows / Linux, the modifier labels and named-key labels (Enter, Esc, Space, arrows, Home/End, PageUp/Down, …) flow through tr_widget! (teksilo-i18n’s compile-time-checked translation macro) so apps that register teksilo-widgets’ framework locales see “Strg+Eingabe” in German, “Ctrl+Entrée” in French, “Ctrl+Enter” in English, etc. Letters, digits, character keys and F1..F12 fall through to Key::Display — those names are universal.

Apps that want full control can bypass this function entirely — the settings widget simply calls format_keystroke at render time, so overriding the visible label means substituting a different formatter at the caller.

Functions§

format_keystroke
Render keystroke as the conventional label for the current platform and active locale.