Repository navigation
Languages
English · Português (Brasil)
The GUI is translatable through JSON catalogs inside the package (screen_watch/i18n/*.json); the
CLI and the diagnostic logging remain in fixed English (the GUI log panel too, because
it is log). Initial languages: pt-BR (fallback) and en-US.
Any valid screen_watch/i18n/xx-YY.json file starts appearing in the window selector and in
--language, without changing code. The _meta must carry:
-
code— equal to the file name (e.g.:pt-BR); -
name— native name shown in the combo (e.g.: "Português (Brasil)"); -
fallback—"pt-BR".
The keys of the new language must cover the same set as pt-BR (en-US serves as the reference);
validate-i18n reports missing/extra keys.
--language TAG > state.json["language"] > ui.language from the YAML > auto (OS locale)
-
autousesQLocale.system()with a fallback tolocale/LANG. - Matching: exact (
pt-BR) → same language (pt→pt-BR) →pt-BRfallback. - The change applies on the next start (no live retranslation). The window selector writes
state.json["language"]. - An unknown
ui.languagegenerates a warning and falls back toauto(it is not an error).
In the v2 YAML:
ui:
language: auto # auto | pt-BR | en-US | any discovered tagpython -m screen_watch --language en-US gui # opens the GUI in English
python -m screen_watch validate-i18n # validates keys, error.*, help.* and _meta- Copy
src/screen_watch/i18n/en-US.jsontosrc/screen_watch/i18n/<new-tag>.json. - Adjust the
_meta(code= file name, nativename,fallback: "pt-BR"). - Translate the values (not the keys). Keep
error.*andhelp.*complete. - Run
python -m screen_watch validate-i18nuntil it isok. - The language appears by itself in the selector and in
--language(discovery is at runtime).
Application errors have stable codes (errors.py::ERROR_CODES, e.g.:
runtime.tesseract_missing): the GUI shows the translated message (error.<code>) from the catalog; the
CLI/log show the text in English. str(exc) is always English; render_error(exc) does the translation.
Each control of the window has a tooltip with purpose + example after ~2 s of hover, with the text
coming from the help.* keys of the catalog.
CI runs validate-i18n in addition to ruff and pytest, so an incomplete catalog breaks the build.
-
Configuration —
ui.languageand precedence - GUI and tray — the language selector
- doc/00 §12.6 — design decisions