i18n with gettext

This commit is contained in:
2022-02-02 19:35:57 +01:00
parent 939c86dbe2
commit 9c28a41904
21 changed files with 686 additions and 437 deletions

View File

@@ -9,23 +9,20 @@ from raven.pluginbase import PluginBase
from raven.plugins.ravenlog.Tab import Tab
from settings import Settings
from raven.i18n import _
class LogFilePlugin(PluginBase):
def __init__(self):
super(LogFilePlugin, self).__init__()
self.settings = None
self.tr = None
def set_settings(self, settings: Settings):
self.settings = settings
def set_translator(self, tr: Callable[[str], str]):
self.tr = tr
def create_tab(self, file: str) -> Optional[Tab]:
if not os.path.isfile(file):
message = QMessageBox(QMessageBox.Icon.Warning, "File not found",
"'%s' is not a file or cannot be opened" % file)
message = QMessageBox(QMessageBox.Icon.Warning, _("File not found"),
_("'{0}' is not a file or cannot be opened").format(file))
message.exec()
return None