i18n with gettext
This commit is contained in:
20
bigtext.py
20
bigtext.py
@@ -25,7 +25,7 @@ from ravenui import RavenUI
|
||||
from settings import Settings
|
||||
from watchdog.observers import Observer
|
||||
from watchdog.events import FileSystemEventHandler
|
||||
|
||||
from raven.i18n import _
|
||||
|
||||
|
||||
class FileObserver(FileSystemEventHandler):
|
||||
@@ -168,24 +168,24 @@ class InnerBigText(QWidget):
|
||||
def _open_menu(self, position):
|
||||
menu = QMenu(self)
|
||||
|
||||
copy_clipboard = QAction(QIcon.fromTheme("edit-copy"), self.tr("&Copy to Clipboard"), self,
|
||||
copy_clipboard = QAction(QIcon.fromTheme("edit-copy"), _("&Copy to Clipboard"), self,
|
||||
triggered=self.copy_selection)
|
||||
copy_clipboard.setShortcut("CTRL+C")
|
||||
copy_clipboard.setDisabled(not self._has_selection())
|
||||
menu.addAction(copy_clipboard)
|
||||
|
||||
copy_to_file = QAction(QIcon.fromTheme("document-save-as"), self.tr("Copy to &File"), self,
|
||||
copy_to_file = QAction(QIcon.fromTheme("document-save-as"), _("Copy to &File"), self,
|
||||
triggered=self._copy_selection_to_file)
|
||||
copy_to_file.setDisabled(not self._has_selection())
|
||||
menu.addAction(copy_to_file)
|
||||
|
||||
select_all = QAction(QIcon.fromTheme("edit-select-all"), self.tr("Select &All"), self,
|
||||
select_all = QAction(QIcon.fromTheme("edit-select-all"), _("Select &All"), self,
|
||||
triggered=self._select_all)
|
||||
select_all.setShortcut("CTRL+A")
|
||||
menu.addAction(select_all)
|
||||
|
||||
manage_highlighting = QAction(
|
||||
self.tr("&Highlighter"),
|
||||
_("&Highlighter"),
|
||||
self,
|
||||
triggered=lambda: HighlightingDialog(self.model.settings).exec())
|
||||
manage_highlighting.setShortcut("CTRL+H")
|
||||
@@ -329,13 +329,13 @@ class InnerBigText(QWidget):
|
||||
if end - start > (1024 ** 2) * 5:
|
||||
you_sure = QMessageBox(
|
||||
QMessageBox.Icon.Warning,
|
||||
self.tr("data selection"),
|
||||
self.tr(
|
||||
_("data selection"),
|
||||
_(
|
||||
"You have selected <b>{0}</b> of data.").format(bytes_human_readable))
|
||||
you_sure.setStandardButtons(QMessageBox.StandardButton.Cancel)
|
||||
you_sure.addButton(QPushButton(self.tr("Copy {0} to Clipboard").format(bytes_human_readable)),
|
||||
you_sure.addButton(QPushButton(_("Copy {0} to Clipboard").format(bytes_human_readable)),
|
||||
QMessageBox.ButtonRole.AcceptRole)
|
||||
you_sure.addButton(QPushButton(self.tr("Write to File")), QMessageBox.ActionRole)
|
||||
you_sure.addButton(QPushButton(_("Write to File")), QMessageBox.ActionRole)
|
||||
you_sure.setDefaultButton(QMessageBox.StandardButton.Cancel)
|
||||
result = you_sure.exec()
|
||||
if result == 1: # second custom button has the number 1
|
||||
@@ -355,7 +355,7 @@ class InnerBigText(QWidget):
|
||||
end = max(self.selection_highlight.start_byte, self.selection_highlight.end_byte)
|
||||
dialog = QFileDialog(self)
|
||||
(selected_file, _filter) = dialog.getSaveFileName(
|
||||
caption=self.tr("Save File"),
|
||||
caption=_("Save File"),
|
||||
dir=os.path.dirname(self.model.get_file())
|
||||
)
|
||||
if selected_file:
|
||||
|
||||
Reference in New Issue
Block a user