From 2307a63d26b3da6236e017f8228e4d5f401e4c17 Mon Sep 17 00:00:00 2001 From: fkDead Date: Thu, 26 Nov 2026 14:00:07 +0100 Subject: [PATCH] feat(installer): translate the desktop screen --- .../pyanaconda/ui/gui/spokes/fws_desktop.py | 48 ++++++++++++++----- 1 file changed, 36 insertions(+), 12 deletions(-) diff --git a/configs/baseline/airootfs/usr/lib/python3.14/site-packages/pyanaconda/ui/gui/spokes/fws_desktop.py b/configs/baseline/airootfs/usr/lib/python3.14/site-packages/pyanaconda/ui/gui/spokes/fws_desktop.py index 44a607f..55d7601 100644 --- a/configs/baseline/airootfs/usr/lib/python3.14/site-packages/pyanaconda/ui/gui/spokes/fws_desktop.py +++ b/configs/baseline/airootfs/usr/lib/python3.14/site-packages/pyanaconda/ui/gui/spokes/fws_desktop.py @@ -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):