Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions archinstall/lib/global_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,12 +269,17 @@ def _update_lang_text(self) -> None:
The options for the global menu are generated with a static text;
each entry of the menu needs to be updated with the new translation
"""
from archinstall.tui.ui.components import TApp, _translate_bindings

new_options = self._get_menu_options()

for o in new_options:
if o.key is not None:
self._item_group.find_by_key(o.key).text = o.text

if TApp.app is not None:
_translate_bindings(TApp.app)

async def _locale_selection(self, preset: LocaleConfiguration) -> LocaleConfiguration | None:
locale_config = await LocaleMenu(preset).show()
return locale_config
Expand Down
117 changes: 117 additions & 0 deletions archinstall/locales/base.pot
Original file line number Diff line number Diff line change
Expand Up @@ -1709,6 +1709,123 @@ msgstr ""
msgid "Exit search mode"
msgstr ""

msgid "General"
msgstr ""

msgid "Navigation"
msgstr ""

msgid "Selection"
msgstr ""

msgid "Search"
msgstr ""

msgid "Down"
msgstr ""

msgid "Up"
msgstr ""

msgid "Confirm"
msgstr ""

msgid "Focus right"
msgstr ""

msgid "Focus left"
msgstr ""

msgid "Toggle"
msgstr ""

msgid "Show/Hide help"
msgstr ""

msgid "Quit"
msgstr ""

msgid "First"
msgstr ""

msgid "Last"
msgstr ""

msgid "Select"
msgstr ""

msgid "Page Up"
msgstr ""

msgid "Page Down"
msgstr ""

msgid "Page up"
msgstr ""

msgid "Page down"
msgstr ""

msgid "Page Left"
msgstr ""

msgid "Page Right"
msgstr ""

msgid "Cursor up"
msgstr ""

msgid "Cursor down"
msgstr ""

msgid "Cursor right"
msgstr ""

msgid "Cursor left"
msgstr ""

msgid "Top"
msgstr ""

msgid "Bottom"
msgstr ""

msgid "Home"
msgstr ""

msgid "End"
msgstr ""

msgid "Toggle option"
msgstr ""

msgid "Scroll Up"
msgstr ""

msgid "Scroll Down"
msgstr ""

msgid "Scroll Left"
msgstr ""

msgid "Scroll Right"
msgstr ""

msgid "Scroll Home"
msgstr ""

msgid "Scroll End"
msgstr ""

msgid "Focus Next"
msgstr ""

msgid "Focus Previous"
msgstr ""

msgid "Copy selected text"
msgstr ""

msgid ""
"labwc needs access to your seat (collection of hardware devices i.e. "
"keyboard, mouse, etc)"
Expand Down
Binary file modified archinstall/locales/uk/LC_MESSAGES/base.mo
Binary file not shown.
117 changes: 117 additions & 0 deletions archinstall/locales/uk/LC_MESSAGES/base.po
Original file line number Diff line number Diff line change
Expand Up @@ -1663,6 +1663,123 @@ msgstr "Запустити режим пошуку"
msgid "Exit search mode"
msgstr "Вийти з режиму пошуку"

msgid "General"
msgstr "Загальне"

msgid "Navigation"
msgstr "Навігація"

msgid "Selection"
msgstr "Вибір"

msgid "Search"
msgstr "Пошук"

msgid "Down"
msgstr "Вниз"

msgid "Up"
msgstr "Вгору"

msgid "Confirm"
msgstr "Підтвердити"

msgid "Focus right"
msgstr "Фокус вправо"

msgid "Focus left"
msgstr "Фокус вліво"

msgid "Toggle"
msgstr "Перемкнути"

msgid "Show/Hide help"
msgstr "Показати/Сховати довідку"

msgid "Quit"
msgstr "Вийти"

msgid "First"
msgstr "На початок"

msgid "Last"
msgstr "В кінець"

msgid "Select"
msgstr "Обрати"

msgid "Page Up"
msgstr "Сторінка вгору"

msgid "Page Down"
msgstr "Сторінка вниз"

msgid "Page up"
msgstr "Сторінка вгору"

msgid "Page down"
msgstr "Сторінка вниз"

msgid "Page Left"
msgstr "Сторінка вліво"

msgid "Page Right"
msgstr "Сторінка вправо"

msgid "Cursor up"
msgstr "Курсор вгору"

msgid "Cursor down"
msgstr "Курсор вниз"

msgid "Cursor right"
msgstr "Курсор вправо"

msgid "Cursor left"
msgstr "Курсор вліво"

msgid "Top"
msgstr "На початок"

msgid "Bottom"
msgstr "В кінець"

msgid "Home"
msgstr "Початок"

msgid "End"
msgstr "Кінець"

msgid "Toggle option"
msgstr "Перемкнути опцію"

msgid "Scroll Up"
msgstr "Прокрутка вгору"

msgid "Scroll Down"
msgstr "Прокрутка вниз"

msgid "Scroll Left"
msgstr "Прокрутка вліво"

msgid "Scroll Right"
msgstr "Прокрутка вправо"

msgid "Scroll Home"
msgstr "Прокрутка на початок"

msgid "Scroll End"
msgstr "Прокрутка в кінець"

msgid "Focus Next"
msgstr "Фокус на наступний"

msgid "Focus Previous"
msgstr "Фокус на попередній"

msgid "Copy selected text"
msgstr "Копіювати виділений текст"

msgid "labwc needs access to your seat (collection of hardware devices i.e. keyboard, mouse, etc)"
msgstr "labwc потребує доступ до вашого місця (набору апаратних пристроїв, таких як клавіатура, миша тощо)"

Expand Down
2 changes: 1 addition & 1 deletion archinstall/tui/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def get_help_text() -> str:
max_key_width = max([help.get_key_width() for help in help_texts])

for help_group in help_texts:
help_output += f'{help_group.group_id.value}\n'
help_output += f'{tr(help_group.group_id.value)}\n'
divider_len = max_desc_width + max_key_width
help_output += '-' * divider_len + '\n'

Expand Down
28 changes: 27 additions & 1 deletion archinstall/tui/ui/components.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import sys
from abc import ABC, abstractmethod
from collections.abc import Awaitable, Callable
from dataclasses import dataclass
from dataclasses import dataclass, replace
from enum import Enum, auto
from typing import Any, ClassVar, Literal, TypeVar, cast, override

Expand All @@ -27,6 +27,13 @@
ValueT = TypeVar('ValueT')


def _translate_bindings(widget: Any) -> None:
if widget._merged_bindings is None:
return
for key, bindings in widget._merged_bindings.key_to_bindings.items():
widget._bindings.key_to_bindings[key] = [replace(b, description=tr(b.description)) if b.description else b for b in bindings]


class BaseScreen(Screen[Result[ValueT]]):
BINDINGS: ClassVar = [
Binding('escape', 'cancel_operation', 'Cancel', show=True),
Expand Down Expand Up @@ -97,6 +104,7 @@ def compose(self) -> ComposeResult:
yield Footer()

def on_mount(self) -> None:
_translate_bindings(self)
if self._data_callback:
self._exec_callback()
else:
Expand Down Expand Up @@ -129,6 +137,10 @@ class _OptionList(OptionList):
Binding('k', 'cursor_up', 'Up', show=False),
]

@override
def on_mount(self) -> None:
_translate_bindings(self)


class OptionListScreen(BaseScreen[ValueT]):
"""
Expand Down Expand Up @@ -271,6 +283,7 @@ def compose(self) -> ComposeResult:
yield Footer()

def on_mount(self) -> None:
_translate_bindings(self)
self._update_options(self._options)
self.query_one(OptionList).focus()

Expand Down Expand Up @@ -355,6 +368,10 @@ class _SelectionList(SelectionList[ValueT]):
Binding('k', 'cursor_up', 'Up', show=False),
]

@override
def on_mount(self) -> None:
_translate_bindings(self)


class SelectListScreen(BaseScreen[ValueT]):
"""
Expand Down Expand Up @@ -499,6 +516,7 @@ def on_input_submitted(self, event: Input.Submitted) -> None:
self._handle_search_action()

def on_mount(self) -> None:
_translate_bindings(self)
self._update_options(self._options)
self.query_one(SelectionList).focus()

Expand Down Expand Up @@ -660,6 +678,7 @@ def compose(self) -> ComposeResult:
yield Footer()

def on_mount(self) -> None:
_translate_bindings(self)
self._update_selection()

def action_focus_right(self) -> None:
Expand Down Expand Up @@ -815,6 +834,7 @@ def compose(self) -> ComposeResult:
yield Footer()

def on_mount(self) -> None:
_translate_bindings(self)
input_field = self.query_one('#main_input', Input)
input_field.focus()

Expand Down Expand Up @@ -854,6 +874,10 @@ class _DataTable(DataTable[ValueT]):
Binding('k', 'cursor_up', 'Up', show=False),
]

@override
def on_mount(self) -> None:
_translate_bindings(self)


class TableSelectionScreen(BaseScreen[ValueT]):
BINDINGS: ClassVar = [
Expand Down Expand Up @@ -974,6 +998,7 @@ def compose(self) -> ComposeResult:
yield Footer()

def on_mount(self) -> None:
_translate_bindings(self)
self._display_header(True)
data_table = self.query_one(DataTable)
data_table.cell_padding = 2
Expand Down Expand Up @@ -1229,6 +1254,7 @@ def action_trigger_help(self) -> None:
_ = self.screen.mount(HelpPanel())

def on_mount(self) -> None:
_translate_bindings(self)
self._run_worker()

@work
Expand Down
Loading