feat(installer): translate the desktop screen

This commit is contained in:
nocode committed 2026-11-26 14:00:07 +01:00
1 parent 50fef2d212
commit 2307a63d26
1 file changed
+36 -12
@@ -16,21 +16,29 @@
# « pacman -S » du bureau + d'un navigateur (Firefox), et active le display
# manager. « cli » (défaut) = aucun bureau, rien à installer.
from pyanaconda.core.i18n import CN_, _
from pyanaconda.core.i18n import CN_
from pyanaconda.ui.categories.software import SoftwareCategory
from pyanaconda.ui.gui.spokes import NormalSpoke
from pyanaconda.ui.gui.spokes.fws_i18n import t
__all__ = ["FWSDesktopSpoke"]
# clé interne (écrite dans /tmp/fws-desktop) → libellé affiché dans le statut.
_CHOICES = [
("cli", _("Command line only (no desktop)")),
("gnome", "GNOME"),
("kde", "KDE Plasma"),
("hyprland", "Hyprland — Wayland (non compatible VR)"),
("i3", "i3 — X11 (compatible VR : SteamVR)"),
("xfce", "XFCE"),
]
def _choices():
# A function, not a constant: the labels must follow the language picked
# on the first screen, which can change after this module is imported.
# Bare product names are the same in every language.
return [
("cli", t("desktop.choice_cli")),
("gnome", "GNOME"),
("kde", "KDE Plasma"),
("hyprland", t("desktop.choice_hyprland")),
("i3", t("desktop.choice_i3")),
("xfce", "XFCE"),
]
_DESKTOP_FILE = "/tmp/fws-desktop"
@@ -42,6 +50,10 @@ class FWSDesktopSpoke(NormalSpoke):
uiFile = "spokes/fws_desktop.glade"
category = SoftwareCategory
icon = "preferences-desktop-display-symbolic"
# Left to Anaconda: it only labels the hub tile (hidden by fws_wizard, shown
# only if the wizard falls back to the classic menu), sorts the tiles and
# names the spoke in logs. The header the user sees is "window-name",
# translated in refresh().
title = CN_("GUI|Spoke", "_Desktop Environment")
@staticmethod
@@ -63,7 +75,7 @@ class FWSDesktopSpoke(NormalSpoke):
def initialize(self):
NormalSpoke.initialize(self)
for key, _label in _CHOICES:
for key, _label in _choices():
self._radios[key] = self.builder.get_object("radio_" + key)
# Reprend un éventuel choix déjà écrit (revisite du spoke).
try:
@@ -75,6 +87,18 @@ class FWSDesktopSpoke(NormalSpoke):
pass
def refresh(self):
# The texts are set here rather than taken from the glade: refresh()
# runs each time the screen is shown, so they follow a language
# changed in the meantime on the first screen.
window_name = t("desktop.window_name")
self.window.set_property("window-name", window_name)
self.window.get_accessible().set_name(window_name)
self.builder.get_object("fws_desktop_desc").set_text(t("desktop.intro"))
for key, label in _choices():
radio = self._radios.get(key)
if radio is not None:
radio.set_label(label)
# Coche le bouton correspondant au choix courant.
rb = (self._radios.get(self._choice)
or self._radios.get(self._DEFAULT_CHOICE))
@@ -95,10 +119,10 @@ class FWSDesktopSpoke(NormalSpoke):
@property
def status(self):
for key, label in _CHOICES:
for key, label in _choices():
if key == self._choice:
return label
return _("Command line only (no desktop)")
return t("desktop.choice_cli")
@property
def completed(self):