Fix use of `self.tr` for translation. By @real-yfprojects (#1236)

This commit is contained in:
yfprojects 2022-03-28 08:10:25 +00:00 committed by GitHub
parent 5b8f3a2915
commit a461b06efc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 14 deletions

View File

@ -58,7 +58,7 @@ class ExtractDialog(ExtractDialogBase, ExtractDialogUI):
# add extract button to button box
self.extractButton = QPushButton(self)
self.extractButton.setObjectName("extractButton")
self.extractButton.setText(self.tr("ExtractDialog", "Extract"))
self.extractButton.setText(self.tr("Extract"))
self.buttonBox.addButton(self.extractButton,
QDialogButtonBox.ButtonRole.AcceptRole)
@ -73,7 +73,7 @@ class ExtractDialog(ExtractDialogBase, ExtractDialogUI):
# setupUi calls retranslateUi
if hasattr(self, 'extractButton'):
self.extractButton.setText(self.tr("ExtractDialog", "Extract"))
self.extractButton.setText(self.tr("Extract"))
class ExtractTree(TreeModel):

View File

@ -228,7 +228,7 @@ class MainWindow(MainWindowBase, MainWindowUI):
except ImportFailedException as exception:
QMessageBox.critical(None,
self.tr('Failed to import profile'),
self.tr(str(exception)))
str(exception))
return
window = ImportWindow(profile_export=profile_export)
self.window = window

View File

@ -1,8 +1,9 @@
from PyQt5 import uic, QtCore
from PyQt5 import QtCore, uic
from PyQt5.QtWidgets import QDialogButtonBox
from vorta.i18n import translate, trans_late
from vorta.utils import get_asset
from vorta.i18n import trans_late, translate
from vorta.store.models import BackupProfileModel
from vorta.utils import get_asset
uifile = get_asset('UI/profileadd.ui')
AddProfileUI, AddProfileBase = uic.loadUiType(uifile)
@ -55,7 +56,7 @@ class AddProfileWindow(AddProfileBase, AddProfileUI):
self._set_status(translate('AddProfileWindow', self.name_exists))
return False
self._set_status(self.tr(''))
self._set_status('')
return True

View File

@ -60,7 +60,7 @@ class AddRepoWindow(AddRepoBase, AddRepoUI):
# setupUi calls retranslateUi
if hasattr(self, 'saveButton'):
self.saveButton.setText(self.tr("AdRepoWindowDialog", "Add"))
self.saveButton.setText(self.tr("Add"))
def set_icons(self):
self.chooseLocalFolderButton.setIcon(get_colored_icon('folder-open'))
@ -153,15 +153,15 @@ class AddRepoWindow(AddRepoBase, AddRepoUI):
def init_encryption(self):
encryption_algos = [
['Repokey-Blake2 (Recommended, key stored in repository)', 'repokey-blake2'],
['Repokey', 'repokey'],
['Keyfile-Blake2 (Key stored in home directory)', 'keyfile-blake2'],
['Keyfile', 'keyfile'],
['None (not recommended)', 'none']
[self.tr('Repokey-Blake2 (Recommended, key stored in repository)'), 'repokey-blake2'],
[self.tr('Repokey'), 'repokey'],
[self.tr('Keyfile-Blake2 (Key stored in home directory)'), 'keyfile-blake2'],
[self.tr('Keyfile'), 'keyfile'],
[self.tr('None (not recommended)'), 'none']
]
for desc, name in encryption_algos:
self.encryptionComboBox.addItem(self.tr(desc), name)
self.encryptionComboBox.addItem(desc, name)
if not borg_compat.check('BLAKE2'):
self.encryptionComboBox.model().item(0).setEnabled(False)