feat(installer): translate the desktop screen
This commit is contained in:
1 file changed
+32
-8
+32
-8
@@ -16,21 +16,29 @@
|
|||||||
# « pacman -S » du bureau + d'un navigateur (Firefox), et active le display
|
# « pacman -S » du bureau + d'un navigateur (Firefox), et active le display
|
||||||
# manager. « cli » (défaut) = aucun bureau, rien à installer.
|
# 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.categories.software import SoftwareCategory
|
||||||
from pyanaconda.ui.gui.spokes import NormalSpoke
|
from pyanaconda.ui.gui.spokes import NormalSpoke
|
||||||
|
from pyanaconda.ui.gui.spokes.fws_i18n import t
|
||||||
|
|
||||||
__all__ = ["FWSDesktopSpoke"]
|
__all__ = ["FWSDesktopSpoke"]
|
||||||
|
|
||||||
|
|
||||||
# clé interne (écrite dans /tmp/fws-desktop) → libellé affiché dans le statut.
|
# clé interne (écrite dans /tmp/fws-desktop) → libellé affiché dans le statut.
|
||||||
_CHOICES = [
|
def _choices():
|
||||||
("cli", _("Command line only (no desktop)")),
|
# 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"),
|
("gnome", "GNOME"),
|
||||||
("kde", "KDE Plasma"),
|
("kde", "KDE Plasma"),
|
||||||
("hyprland", "Hyprland — Wayland (non compatible VR)"),
|
("hyprland", t("desktop.choice_hyprland")),
|
||||||
("i3", "i3 — X11 (compatible VR : SteamVR)"),
|
("i3", t("desktop.choice_i3")),
|
||||||
("xfce", "XFCE"),
|
("xfce", "XFCE"),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
_DESKTOP_FILE = "/tmp/fws-desktop"
|
_DESKTOP_FILE = "/tmp/fws-desktop"
|
||||||
|
|
||||||
|
|
||||||
@@ -42,6 +50,10 @@ class FWSDesktopSpoke(NormalSpoke):
|
|||||||
uiFile = "spokes/fws_desktop.glade"
|
uiFile = "spokes/fws_desktop.glade"
|
||||||
category = SoftwareCategory
|
category = SoftwareCategory
|
||||||
icon = "preferences-desktop-display-symbolic"
|
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")
|
title = CN_("GUI|Spoke", "_Desktop Environment")
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@@ -63,7 +75,7 @@ class FWSDesktopSpoke(NormalSpoke):
|
|||||||
|
|
||||||
def initialize(self):
|
def initialize(self):
|
||||||
NormalSpoke.initialize(self)
|
NormalSpoke.initialize(self)
|
||||||
for key, _label in _CHOICES:
|
for key, _label in _choices():
|
||||||
self._radios[key] = self.builder.get_object("radio_" + key)
|
self._radios[key] = self.builder.get_object("radio_" + key)
|
||||||
# Reprend un éventuel choix déjà écrit (revisite du spoke).
|
# Reprend un éventuel choix déjà écrit (revisite du spoke).
|
||||||
try:
|
try:
|
||||||
@@ -75,6 +87,18 @@ class FWSDesktopSpoke(NormalSpoke):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def refresh(self):
|
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.
|
# Coche le bouton correspondant au choix courant.
|
||||||
rb = (self._radios.get(self._choice)
|
rb = (self._radios.get(self._choice)
|
||||||
or self._radios.get(self._DEFAULT_CHOICE))
|
or self._radios.get(self._DEFAULT_CHOICE))
|
||||||
@@ -95,10 +119,10 @@ class FWSDesktopSpoke(NormalSpoke):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def status(self):
|
def status(self):
|
||||||
for key, label in _CHOICES:
|
for key, label in _choices():
|
||||||
if key == self._choice:
|
if key == self._choice:
|
||||||
return label
|
return label
|
||||||
return _("Command line only (no desktop)")
|
return t("desktop.choice_cli")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def completed(self):
|
def completed(self):
|
||||||
|
|||||||
Reference in new issue
Block a user