i18n with QT
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import sys
|
||||
from typing import Optional
|
||||
from typing import Optional, Callable
|
||||
|
||||
from PySide6.QtCore import Qt
|
||||
from PySide6.QtWidgets import QDockWidget
|
||||
@@ -16,8 +16,12 @@ from raven.plugins.ravenlog.Tab import Tab
|
||||
class RavenLogPlugin(PluginBase):
|
||||
def __init__(self):
|
||||
super(RavenLogPlugin, self).__init__()
|
||||
self.tr = None
|
||||
self.main_window = None
|
||||
|
||||
def set_translator(self, tr: Callable[[str], str]):
|
||||
self.tr = tr
|
||||
|
||||
def create_main_window(self):
|
||||
if not self.main_window:
|
||||
self.main_window = MainWindow()
|
||||
@@ -42,7 +46,7 @@ class RavenLogPlugin(PluginBase):
|
||||
|
||||
def _action_about(self) -> RAction:
|
||||
about_action = RAction(
|
||||
"&About",
|
||||
self.tr("&About"),
|
||||
action=lambda: AboutDialog().exec(),
|
||||
icon_file=constants.raven_icon
|
||||
)
|
||||
@@ -50,6 +54,6 @@ class RavenLogPlugin(PluginBase):
|
||||
|
||||
def _action_close(self) -> RAction:
|
||||
icon = "close" if sys.platform == 'win32' or sys.platform == 'cygwin' else "exit"
|
||||
close_action = RAction("E&xit", action=lambda: self.main_window.destruct(), shortcut='Ctrl+X',
|
||||
close_action = RAction(self.tr("E&xit"), action=lambda: self.main_window.destruct(), shortcut='Ctrl+X',
|
||||
icon_from_theme=icon)
|
||||
return close_action
|
||||
|
||||
Reference in New Issue
Block a user