Commit Graph
1 Commits
Author SHA1 Message Date
688d9e9bd2 feat(language): start a first run from the language the system points at (#796)
* feat(language): start a first run from the language the system points at

Nothing asked the system what language the user speaks, so whisper.cpp always
began on auto-detect and VOSK on a hardcoded en-us. Both are wrong for anyone
who does not speak English, and neither improves on its own because nothing
ever suggests setting a language.

Seed the language on first run only, so a saved choice — including a deliberate
"auto" — is never touched. The keyboard layout is consulted before the locale:
running the desktop in English while speaking something else is common among
the people who install a Linux dictation tool, which makes the interface
language a weak signal for the spoken one. A "us" layout is the default on many
installs and says little, so the locale gets a say before it is accepted.

localectl is used rather than setxkbmap, which reports nothing useful on
Wayland. Detection failures leave the packaged default in place.

Closes #777

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TKVa2qTLQYMCHffjp97yqT

* fix(language): prefer LANGUAGE, keep cs/ca, map nb_NO

LANG was consulted before LANGUAGE, so a gettext preference list lost to
the fallback locale. C/POSIX detection used startswith("c"), which
rejected Czech and Catalan. nb_NO normalised to nb_no and missed the
nb→no catalogue map, so Norwegian fell through to en-us.

Tests cover LANG+LANGUAGE, LANGUAGE=cs, and nb_NO.

* fix(language): walk LANGUAGE prefs until one is supported

split(":")[0] dropped later supported preferences, so first-run could
stay on auto when LANGUAGE started with an unsupported tag. Try each
preference through the catalogue map. Annotate _seed_language_from_system.

* style(language): keep _language_from_locale_env on one line for black

* fix(language): fall through unmapped LANGUAGE to LANG

When every LANGUAGE preference missed the catalogue, the helper returned
before LANG was examined, so first-run could stay on auto. Skip unmapped
env vars and keep looking. Regression: LANGUAGE=xx:yy with LANG=pl_PL → pl.

---------

Co-authored-by: Kacper Paczos <23406555+kacperpaczos@users.noreply.github.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Jatin K Malik <jatinkrmalik@gmail.com>
2026-09-07 14:11:40 -07:00