Repository navigation
API turboframe.ui.language
Source: turboframe/ui/language.py. Generated from the code of TurboFrame 0.3.0 by tools/wiki_api.py.
Options > Language: the language of the interface, from the next start.
An application's texts are made when it starts (see turboframe.i18n), so the choice is kept in its store ("language") and applies the next time: the application passes it to choose_language(setting=...) when it starts. Each language is named in itself (English, Español), so anyone finds theirs.
An application mixes LanguageMixin into its DesktopApp, sets language_store (an object with load() -> dict and save(dict): its config) and language_domain (its turboframe.i18n.Domain), names its languages in LANGUAGES, and calls choose_language() from a worker (or language_command(command) for CM_LANGUAGE).
AUTO, CM_LANGUAGE, KEY, LANGUAGES, LanguageDialog, LanguageMixin, hotkey_label
'auto'
10306
'language'
{'auto': "~A~utomatic (the system's)", 'en': '~E~nglish', 'es': 'E~s~pañol'}
class LanguageDialog(TVDialog)
LanguageDialog(codes: list[str], labels: list[str], current: str)The languages (codes, named by labels) as radio buttons. chosen holds the code (auto, en, es...) once it ends with OK.
valid(command: Command) -> bool
class LanguageMixinOptions > Language, mixed into a DesktopApp. The class attributes and hooks below have defaults; an application sets or overrides the ones that differ.
-
language_choices() -> list[str]:autoand the languages with a catalogue: the domain's, or TurboFrame's without one. -
language_label(code: str) -> str: A language's name, fromLANGUAGES(autoin the interface's language, TurboFrame's name for it whenLANGUAGEShas none), with a hotkey; the code itself for a language it does not name. -
async language_saved(code: str) -> None: The choice was kept: say it applies from the next start. -
language_setting() -> str: The language kept in the store (autowhen there is none). -
async choose_language() -> None: Run the dialog (from a worker); OK keeps a new choice inlanguage_store. -
async language_command(command: int) -> bool: RunCM_LANGUAGE(from a worker); False for another command.
def hotkey_label(name: str) -> strname with a hotkey: its own ~X~, else its first letter.
TurboFrame · part of Divengine · GPL-3.0-or-later · report an issue
Tutorial
Examples
The desktop
- The Desktop
- Application Mixins
- Windows and Lists
- Dialogs
- Histories
- Progress
- Themes and Colors
- Glyphs
- Settings and Recent Files
- Command Palette
Editing
Tasks
Languages
Running
Reference
Links