diff --git a/configs/baseline/airootfs/usr/lib/python3.14/site-packages/pyanaconda/ui/gui/spokes/fws_recap.py b/configs/baseline/airootfs/usr/lib/python3.14/site-packages/pyanaconda/ui/gui/spokes/fws_recap.py index 364237f..049cb70 100644 --- a/configs/baseline/airootfs/usr/lib/python3.14/site-packages/pyanaconda/ui/gui/spokes/fws_recap.py +++ b/configs/baseline/airootfs/usr/lib/python3.14/site-packages/pyanaconda/ui/gui/spokes/fws_recap.py @@ -50,29 +50,38 @@ from pyanaconda.modules.common.structures.user import UserData from pyanaconda.ui.gui import GraphicalUserInterface from pyanaconda.ui.gui.hubs.summary import SummaryHub from pyanaconda.ui.gui.spokes import StandaloneSpoke +from pyanaconda.ui.gui.spokes.fws_i18n import t log = get_module_logger(__name__) __all__ = ["FWSRecapSpoke"] + # Doit rester aligné sur le %post du kickstart (étape « Bureau choisi ») et # sur les libellés de la spoke fws_desktop. -_DESKTOP_LABELS = { - "cli": "ligne de commande uniquement (aucun bureau)", - "gnome": "GNOME (+ Firefox, GDM)", - "kde": "KDE Plasma (+ Firefox, SDDM)", - "hyprland": "Hyprland — Wayland, non compatible VR (+ Firefox, SDDM)", - "i3": "i3 — X11, compatible VR/SteamVR (+ Firefox, SDDM)", - "xfce": "XFCE (+ Firefox, SDDM)", -} +def _desktop_label(desk): + # Built on each call rather than kept as a module constant, so the labels + # follow a language changed on the first screen. + labels = { + "cli": t("recap.desktop_cli"), + "gnome": t("recap.desktop_gnome"), + "kde": t("recap.desktop_kde"), + "hyprland": t("recap.desktop_hyprland"), + "i3": t("recap.desktop_i3"), + "xfce": t("recap.desktop_xfce"), + } + return labels.get(desk, desk) -_PARTITIONING_LABELS = { - "AUTOMATIC": "automatique (recommandé)", - "INTERACTIVE": "personnalisé (assistant)", - "CUSTOM": "personnalisé", - "BLIVET": "avancé (blivet-gui)", - "MANUAL": "points de montage manuels", -} + +def _partitioning_label(method): + labels = { + "AUTOMATIC": t("recap.partitioning_automatic"), + "INTERACTIVE": t("recap.partitioning_interactive"), + "CUSTOM": t("recap.partitioning_custom"), + "BLIVET": t("recap.partitioning_blivet"), + "MANUAL": t("recap.partitioning_manual"), + } + return labels.get(method, method) def _safe(getter, default): @@ -108,67 +117,82 @@ def _config_lines(): lang = _safe(lambda: LOCALIZATION.get_proxy().Language, "") if lang: - lines.append(f" • Langue : {lang}") + lines.append((t("recap.row_language"), lang)) layouts = _safe(lambda: list(LOCALIZATION.get_proxy().XLayouts), []) if layouts: - lines.append(f" • Clavier (X11) : {', '.join(layouts)}") + lines.append((t("recap.row_keyboard"), ", ".join(layouts))) tz = _safe(lambda: TIMEZONE.get_proxy().Timezone, "") if tz: ntp = _safe(lambda: TIMEZONE.get_proxy().NTPEnabled, None) - suffix = {True: " — synchronisation NTP activée", - False: " — synchronisation NTP désactivée"}.get(ntp, "") - lines.append(f" • Fuseau horaire : {tz}{suffix}") + tz_txt = {True: t("recap.timezone_ntp_on", timezone=tz), + False: t("recap.timezone_ntp_off", timezone=tz)}.get(ntp, tz) + lines.append((t("recap.row_timezone"), tz_txt)) users = _safe( lambda: UserData.from_structure_list(USERS.get_proxy().Users), []) if users: names = ", ".join(u.name for u in users if u.name) - lines.append(f" • Utilisateur(s) : {names} (sudo via wheel)") + lines.append((t("recap.row_users"), t("recap.users_value", users=names))) else: - lines.append(" • Utilisateur(s) : AUCUN — pensez-y avant de lancer !") + lines.append((t("recap.row_users"), t("recap.users_none"))) root_locked = _safe(lambda: USERS.get_proxy().IsRootAccountLocked, None) root_pw = _safe(lambda: USERS.get_proxy().IsRootPasswordSet, None) if root_locked: - root_txt = "verrouillé (recommandé)" + root_txt = t("recap.root_locked") elif root_pw: - root_txt = "actif, mot de passe défini" + root_txt = t("recap.root_password_set") elif root_pw is not None: # Même règle que l'étape « Sécurité » du %post : un root resté sans # mot de passe sera verrouillé en fin d'installation. - root_txt = "sans mot de passe → sera VERROUILLÉ en fin d'install" + root_txt = t("recap.root_no_password") else: root_txt = "" if root_txt: - lines.append(f" • Compte root : {root_txt}") + lines.append((t("recap.row_root"), root_txt)) # Hostname : écrit par le spoke Utilisateur (patch user.py du paquet # anaconda). Même nettoyage / même défaut que le %post --nochroot. hn = "".join(c for c in _read_flag("/tmp/fws-hostname") if c.isalnum() or c in "._-") or "fws" - lines.append(f" • Nom de machine : {hn}") + lines.append((t("recap.row_hostname"), hn)) # Bureau : écrit par fws_desktop.apply() (sortie de la spoke). Absent = # spoke jamais visitée = « cli », exactement le défaut du %post. desk = _read_flag("/tmp/fws-desktop") or "cli" - lines.append(f" • Bureau : {_DESKTOP_LABELS.get(desk, desk)}") + lines.append((t("recap.row_desktop"), _desktop_label(desk))) method = _safe( lambda: STORAGE.get_proxy( STORAGE.get_proxy().AppliedPartitioning).PartitioningMethod, "") if method: - lines.append(" • Partitionnement : " - f"{_PARTITIONING_LABELS.get(method, method)}") + lines.append((t("recap.row_partitioning"), _partitioning_label(method))) return lines, desk, method +def _format_rows(rows, width): + """Lay out (label, value) pairs as " • label : value" lines.""" + # Labels are padded to the longest one of the current language so the + # values line up in the monospace view; the line breaks a translation + # puts in a value continue under the value column. + lines = [] + for label, value in rows: + prefix = f" • {label:<{width}} : " + lines.append(prefix + value.replace("\n", "\n" + " " * len(prefix))) + return "\n".join(lines) + + +def _indent(text): + # Translations keep their own line breaks; the indentation is layout and + # stays here. + return "\n".join(" " + line for line in text.splitlines()) + + def _build_summary(): config_lines, desk, method = _config_lines() - config_text = "\n".join(config_lines) \ - or " (configuration non disponible)" # Disques ciblés par l'installation (spoke « Destination »). selected = set(_safe( @@ -177,70 +201,71 @@ def _build_summary(): for line in _capture("lsblk", "-dno", "NAME,SIZE,MODEL,TYPE").splitlines(): fields = line.split() if fields and fields[-1] == "disk": - mark = " ← CIBLE de l'installation" if fields[0] in selected else "" - disks.append(" • " + " ".join(fields[:-1]) + mark) - disk_text = "\n".join(disks) or " (aucun disque détecté)" + disk = " ".join(fields[:-1]) + if fields[0] in selected: + disk = t("recap.disk_target", disk=disk) + disks.append(" • " + disk) + disk_text = "\n".join(disks) or _indent(t("recap.no_disk")) if method == "AUTOMATIC": - disk_warn = ( - " ⚠ Rien n'a encore été écrit. Le partitionnement automatique\n" - " EFFACERA ENTIÈREMENT le(s) disque(s) cible(s) au lancement.") + disk_warn = _indent(t("recap.disk_warning_automatic")) else: - disk_warn = ( - " ⚠ Rien n'a encore été écrit. Au lancement, ce sont vos choix\n" - " de partitionnement faits dans l'installateur qui s'appliqueront.") + disk_warn = _indent(t("recap.disk_warning_manual")) virt = (_capture("systemd-detect-virt").strip().splitlines() or ["none"])[0] if virt in ("", "none"): - virt = "aucune (machine physique)" + virt = t("recap.virtualization_none") gpus = [] for line in _capture("lspci").splitlines(): low = line.lower() if ("vga" in low or "3d" in low or "display" in low) and ":" in line: gpus.append(" • " + line.split(":", 2)[-1].strip()) - gpu_text = "\n".join(gpus) or " (aucune carte graphique détectée)" + gpu_text = "\n".join(gpus) or _indent(t("recap.no_gpu")) try: net_ok = util.execWithRedirect("ip", ["route", "get", "1.1.1.1"]) == 0 except (OSError, RuntimeError): net_ok = False if net_ok: - net = "disponible ✔" + net = t("recap.network_ok") else: - net = ("INDISPONIBLE ✖ — bureau, drivers et stack FWS ne\n" - " s'installeront PAS (rattrapable au 1er boot)") + net = t("recap.network_down") - extras = ("Steam, Wine, VR (Monado/OpenXR), PacManager" - if desk != "cli" else "rien de plus (choix CLI)") + extras = (t("recap.extras_desktop") + if desk != "cli" else t("recap.extras_cli")) + + hardware_lines = [(t("recap.row_virtualization"), virt), + (t("recap.row_network"), net)] + width = max(len(label) for label, _ in config_lines + hardware_lines) + config_text = _format_rows(config_lines, width) \ + or _indent(t("recap.config_unavailable")) return f"""\ ══════════════════════════════════════════════════════════ - FWS — RÉCAPITULATIF AVANT INSTALLATION + {t("recap.summary_title")} ══════════════════════════════════════════════════════════ -CONFIGURATION CHOISIE +{t("recap.section_config")} {config_text} -DISQUES +{t("recap.section_disks")} {disk_warn} {disk_text} -MATÉRIEL DÉTECTÉ - • Virtualisation : {virt} - • Réseau : {net} - Cartes graphiques (drivers installés automatiquement en fin d'install) : +{t("recap.section_hardware")} +{_format_rows(hardware_lines, width)} + {t("recap.gpus_heading")} {gpu_text} -DÉROULEMENT DE L'INSTALLATION - 1. Partitionnement, puis copie du système live FWS (payload LiveOS) - 2. Noyau + initramfs régénérés (mkinitcpio), GRUB installé - 3. Bureau choisi + navigateur installés (réseau requis) - 4. Matériel : drivers GPU, outils VM, son, Bluetooth, Podman - + si bureau choisi : {extras} +{t("recap.section_steps")} + 1. {t("recap.step_partitioning")} + 2. {t("recap.step_kernel")} + 3. {t("recap.step_desktop")} + 4. {t("recap.step_hardware")} + {t("recap.step_hardware_extras", extras=extras)} -« Précédent » pour revenir modifier vos choix — -« Lancer l'installation » pour démarrer réellement l'installation. +{t("recap.footer")} """ @@ -270,9 +295,6 @@ class FWSRecapSpoke(StandaloneSpoke): def initialize(self): StandaloneSpoke.initialize(self) - # Le bouton « continuer » de CETTE page est le vrai déclencheur : - # l'écran suivant (ProgressSpoke) démarre la file d'installation. - self.window.get_continue_button().set_label("_Lancer l'installation") # Capture pour « Précédent » : initialize() est appelé DEPUIS # GraphicalUserInterface._on_continue_clicked (clic « Commencer @@ -302,7 +324,8 @@ class FWSRecapSpoke(StandaloneSpoke): # (à côté de « Quitter » — leur parent est la GtkButtonBox du bas). quit_button = self.window.get_quit_button() button_box = quit_button.get_parent() - self._back_button = Gtk.Button.new_with_mnemonic("_Précédent") + # Label set by _set_static_texts() on each display. + self._back_button = Gtk.Button(use_underline=True) self._back_button.connect("clicked", self._on_back_clicked) button_box.add(self._back_button) # [Quitter, Lancer l'installation, Précédent] -> Précédent au MILIEU, @@ -338,8 +361,18 @@ class FWSRecapSpoke(StandaloneSpoke): hub.entered.emit(hub) ui._currentAction = hub + def _set_static_texts(self): + # Set here rather than in initialize(): the user can go back to the + # language screen and pick another language before coming back. + self.window.set_property("window-name", t("recap.window_name")) + # Le bouton « continuer » de CETTE page est le vrai déclencheur : + # l'écran suivant (ProgressSpoke) démarre la file d'installation. + self.window.get_continue_button().set_label(t("recap.start_button")) + self._back_button.set_label(t("wizard.back")) + def refresh(self): StandaloneSpoke.refresh(self) + self._set_static_texts() text = _build_summary() self.builder.get_object("recapView").get_buffer().set_text(text) # Copie pour le harnais de debug du .xinitrc (fws-debug.txt).