Fix priority mode names not being translated

This commit is contained in:
DevilXD committed 2025-08-22 19:04:01 +02:00
1 parent 1b17dd6784
commit 9329e52643
1 file changed
+10 -3
+10 -3
View File
@@ -1536,10 +1536,17 @@ class _SettingsVars(TypedDict):
class SettingsPanel: class SettingsPanel:
AUTOSTART_NAME: str = "TwitchDropsMiner" AUTOSTART_NAME: str = "TwitchDropsMiner"
AUTOSTART_KEY: str = "HKCU/Software/Microsoft/Windows/CurrentVersion/Run" AUTOSTART_KEY: str = "HKCU/Software/Microsoft/Windows/CurrentVersion/Run"
PRIORITY_MODES: dict[PriorityMode, str] = {
@cached_property
def PRIORITY_MODES(self) -> dict[PriorityMode, str]:
# NOTE: Translation calls have to be deferred here,
# to allow changing the language before the settings panel is initialized.
return {
PriorityMode.PRIORITY_ONLY: _("gui", "settings", "priority_modes", "priority_only"), PriorityMode.PRIORITY_ONLY: _("gui", "settings", "priority_modes", "priority_only"),
PriorityMode.ENDING_SOONEST: _("gui", "settings", "priority_modes", "ending_soonest"), PriorityMode.ENDING_SOONEST: _("gui", "settings", "priority_modes", "ending_soonest"),
PriorityMode.LOW_AVBL_FIRST: _("gui", "settings", "priority_modes", "low_availability"), PriorityMode.LOW_AVBL_FIRST: _(
"gui", "settings", "priority_modes", "low_availability"
),
} }
def __init__(self, manager: GUIManager, master: ttk.Widget): def __init__(self, manager: GUIManager, master: ttk.Widget):
@@ -2408,7 +2415,7 @@ if __name__ == "__main__":
mock.change_state = lambda state: mock.gui.print(f"State change: {state.value}") mock.change_state = lambda state: mock.gui.print(f"State change: {state.value}")
mock.state_change = lambda state: partial(mock.change_state, state) mock.state_change = lambda state: partial(mock.change_state, state)
mock.request = aiohttp.request mock.request = aiohttp.request
# _.set_language("Dansk") # _.set_language("Русский")
gui = GUIManager(mock) # type: ignore gui = GUIManager(mock) # type: ignore
mock.gui = gui mock.gui = gui
mock.close = gui.stop mock.close = gui.stop