Repository navigation
Translator
Two translators live in the shell: a text translator that shows up in three places — the launcher's @ panel, a sidebar tab and a desktop widget — and the Screen Translator, which translates whatever is on the screen. This page is the text one.
It is built on translate-shell (trans), so it needs no API key and no account: by default it asks Google Translate's public endpoint through trans, and any other engine trans supports (Bing, Yandex, Apertium…) is selectable. The package is in the shell's dependency set (translate-shell); without it the surfaces show a "translate-shell is not installed" state instead of failing silently.
-
Launcher — type
@(prefix configurable under Launcher → Prefixes,search.prefix.translator) and then your text; the translation updates as you type. Enter copies the translation, Ctrl + S reads it aloud, Ctrl + Enter swaps the two languages. The panel is described with the other rich panels in Launcher & Search. -
Sidebar tab — the translator in the left sidebar (the Policies sidebar) with From and To language pickers, Swap languages, Paste, Copy, Clear and Listen. Whether the tab exists is
policies.translator(0off,1default,2expressive). - Desktop widget — Translator in the Widget Manager (Utility group): a small translate card on the wallpaper. See Desktop Widgets.
All three share one language pair and one cache (TranslatorService), so picking Portuguese → English in the sidebar is also what the launcher uses next. Each surface owns its own session — a debounced, cached translation that never lands out of order, and that keeps showing the previous result until the next one arrives so the pane never flashes empty while you type.
With the Google engine the helper returns more than the translation: transliterations (both ways), the detected language (when the source is Detect language), a spelling correction ("Did you mean…"), alternative translations, and a dictionary entry for single words — meanings grouped by part of speech (labelled in your UI language, e.g. "verbo"), synonyms, definitions and example sentences. Other engines return the plain translation only.
Listen downloads Google's text-to-speech for the text in the source or target language (split into ~190-character chunks on sentence boundaries, since the endpoint takes about 200) and hands it to an audio player; stopping the helper stops the sound.
| Key | Default | Meaning |
|---|---|---|
engine |
auto |
auto = Google; run trans -list-engines for others |
sourceLanguage, targetLanguage
|
auto |
The pair currently in use. Stored as codes (pt-BR); older configs that stored endonyms ("Português Brasileiro") are still understood |
defaultSourceLanguage, defaultTargetLanguage
|
auto |
What the pair resets to; auto as target means "the UI language" |
The pair and the engine are set in Settings → Language & Time (Language & Translation). Language names come from trans -list-all and are shown in their own language (endonym), sorted alphabetically.
- Text typed into the translator is sent to the translation engine (Google by default) — don't put secrets in it. Turn it off with
policies.translator = 0if you do not want a path to a third party in the sidebar. - Failures are reported by the helper as
{"ok": false, "error": "…"}(missing-trans,timeout,no-result) and shown in place.
| Piece | Role |
|---|---|
services/TranslatorService.qml |
Language table, shared pair, result cache, text-to-speech |
scripts/translator/translator.py |
languages, translate ENGINE SOURCE TARGET HOST TEXT, speak CODE TEXT over trans
|
modules/ii/sidebarPolicies/translator/ |
TranslatorSession, TranslatorLanguageSheet
|
modules/ii/sidebarPolicies/Translator.qml, modules/ii/overview/TranslatorPanel.qml, modules/ii/background/widgets/productivity/TranslatorWidget.qml
|
The three surfaces |