Skip to content

Commit

Permalink
fix: "5 minutes" translation and fine tuning strings
Browse files Browse the repository at this point in the history
Fix minor translation bug introduced with 8daa19a.
Workaround Weblate bug misinterpreting not escaped %.
Additional fine tuning of strings.
  • Loading branch information
buhtz authored Jun 23, 2023
1 parent a4044ef commit 89cf0d3
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 31 deletions.
32 changes: 24 additions & 8 deletions common/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class Config(configfile.ConfigFileWithProfiles):
SCHEDULE_MODES = {
NONE: _('Disabled'),
AT_EVERY_BOOT: _('At every boot/reboot'),
_5_MIN: _('Every {n} minutes'),
_5_MIN: _('Every {n} minutes').format(n=5),
_10_MIN: _('Every {n} minutes').format(n=10),
_30_MIN: _('Every {n} minutes').format(n=30),
_1_HOUR: _('Every hour'),
Expand Down Expand Up @@ -163,14 +163,30 @@ class Config(configfile.ConfigFileWithProfiles):
DEFAULT_REDIRECT_STDOUT_IN_CRON = True
DEFAULT_REDIRECT_STDERR_IN_CRON = False

exp = _(' EXPERIMENTAL!')
SNAPSHOT_MODES = {
#mode : (<mounttools>, 'ComboBox Text', need_pw|lbl_pw_1, need_2_pw|lbl_pw_2),
'local' : (None, _('Local'), False, False),
'ssh' : (sshtools.SSH, _('SSH'), _('SSH private key'), False),
'local_encfs' : (encfstools.EncFS_mount, _('Local encrypted'), _('Encryption'), False),
'ssh_encfs' : (encfstools.EncFS_SSH, _('SSH encrypted'), _('SSH private key'), _('Encryption'))
}
# mode: (
# <mounttools>,
# 'ComboBox Text',
# need_pw|lbl_pw_1,
# need_2_pw|lbl_pw_2
# ),
'local': (
None, _('Local'), False, False),
'ssh': (
sshtools.SSH, 'SSH', _('SSH private key'), False),
'local_encfs': (
encfstools.EncFS_mount,
'{} {}'.format(_('Local'), _('encrypted')),
_('Encryption'),
False
),
'ssh_encfs': (
encfstools.EncFS_SSH,
_('SSH encrypted'),
_('SSH private key'),
_('Encryption')
)
}

SSH_CIPHERS = {
'default': _('Default'),
Expand Down
6 changes: 3 additions & 3 deletions common/snapshots.py
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ def backup(self, force = False):

if ret_error:
logger.error('Failed to take snapshot !!!', self)
self.setTakeSnapshotMessage(1, _('Failed to take snapshot %s !!!') % sid.displayID)
self.setTakeSnapshotMessage(1, _('Failed to take snapshot {snapshot_id} !!!').format(snapshot_id=sid.displayID))
time.sleep(2)
else:
logger.warning("No new snapshot", self)
Expand Down Expand Up @@ -1646,8 +1646,8 @@ def freeSpace(self, now):
minFreeInodes = self.config.minFreeInodes()
self.setTakeSnapshotMessage(
0,
_('Trying to keep min {perc}% free inodes')
.format(perc=minFreeInodes)
_('Trying to keep min {perc} free inodes')
.format(perc=f'{minFreeInodes}%')
)
logger.debug(
"Keep min {perc}% free inodes".format(perc=minFreeInodes),
Expand Down
5 changes: 4 additions & 1 deletion qt/qtsystrayicon.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ def __init__(self):

self.openLog = self.contextMenu.addAction(icon.VIEW_LAST_LOG, _('View Last Log'))
self.openLog.triggered.connect(self.onOpenLog)
self.startBIT = self.contextMenu.addAction(icon.BIT_LOGO, _('Start BackInTime'))
self.startBIT = self.contextMenu.addAction(
icon.BIT_LOGO,
_('Start {appname}').format(appname=self.config.APP_NAME)
)
self.startBIT.triggered.connect(self.onStartBIT)
self.status_icon.setContextMenu(self.contextMenu)

Expand Down
51 changes: 32 additions & 19 deletions qt/settingsdialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def __init__(self, parent):
self.fillCombo(self.comboModes, store_modes)

# encfs security warning
self.encfsWarning = QLabel('<b>{}:</b>{}'.format(
self.encfsWarning = QLabel('<b>{}:</b> {}'.format(
_('Warning'),
_('{app} uses EncFS for encryption. A recent security audit '
'revealed several possible attack vectors for this. Please '
Expand Down Expand Up @@ -500,9 +500,16 @@ def __init__(self, parent):
layout = QVBoxLayout(tabWidget)

self.lblSshEncfsExcludeWarning = QLabel(
_('<b>Warning:</b> Wildcards (\'foo*\', \'[fF]oo\', \'fo?\') '
'will be ignored with mode \'SSH encrypted\'.\nOnly separate '
'asterisk are allowed (\'foo/*\', \'foo/**/bar\')'), self)
"<b>{}:</b> {}".format(
_("Warning"),
_(
"Wildcards ('foo*', '[fF]oo', 'fo?') will be ignored "
"with mode 'SSH encrypted'.\nOnly separate asterisk "
"are allowed ('foo/*', 'foo/**/bar')"
)
),
self
)
self.lblSshEncfsExcludeWarning.setWordWrap(True)
layout.addWidget(self.lblSshEncfsExcludeWarning)

Expand All @@ -523,7 +530,7 @@ def __init__(self, parent):
layout.addWidget(self.listExclude)
self.listExcludeCount = 0

label = QLabel(_('Highly recommended:'), self)
label = QLabel(_('Highly recommended') + ':', self)
qttools.setFontBold(label)
layout.addWidget(label)
label = QLabel(', '.join(sorted(self.config.DEFAULT_EXCLUDE)), self)
Expand Down Expand Up @@ -645,7 +652,10 @@ def __init__(self, parent):
smlayout = QGridLayout(widget)

self.cbSmartRemoveRunRemoteInBackground = QCheckBox(
_('Run in background on remote Host.') + _(' EXPERIMENTAL!'),
'{} {}!'.format(
_('Run in background on remote Host.'),
_('EXPERIMENTAL')
),
self)
smlayout.addWidget(self.cbSmartRemoveRunRemoteInBackground, 0, 0, 1, 3)

Expand Down Expand Up @@ -868,7 +878,7 @@ def __init__(self, parent):
_('Limit rsync bandwidth usage') + ': ', self)
hlayout.addWidget(self.cbBwlimit)
self.spbBwlimit = QSpinBox(self)
self.spbBwlimit.setSuffix(_(' KB/sec'))
self.spbBwlimit.setSuffix(' ' + _('KB/sec'))
self.spbBwlimit.setSingleStep(100)
self.spbBwlimit.setRange(0, 1000000)
hlayout.addWidget(self.spbBwlimit)
Expand Down Expand Up @@ -1453,8 +1463,8 @@ def saveProfile(self):

if not os.path.isfile(self.txtSshPrivateKeyFile.text()):
self.errorHandler(
_('Private key file "%(file)s" does not exist.')
% {'file': self.txtSshPrivateKeyFile.text()}
_('Private key file "{file}" does not exist.')
.format(file=self.txtSshPrivateKeyFile.text())
)
self.txtSshPrivateKeyFile.setText('')

Expand Down Expand Up @@ -1633,18 +1643,18 @@ def saveProfile(self):

return False

msg = _('The authenticity of host "%(host)s" can\'t be '
'established.\n\n%(keytype)s key fingerprint is:')
msg = msg % {'host': self.config.sshHost(),
'keytype': keyType}
msg = _("The authenticity of host {host} can't be "
"established.\n\n{keytype} key fingerprint is:") \
.format(host='"{}"'.format(self.config.sshHost()),
keytype=keyType)
options = []
lblFingerprint = QLabel(fingerprint + '\n')
lblFingerprint.setWordWrap(False)
lblFingerprint.setFont(QFont('Monospace'))
options.append({'widget': lblFingerprint, 'retFunc': None})
lblQuestion = QLabel(
_('Please verify this fingerprint! Would you like to '
'add it to your \'known_hosts\' file?')
_("Please verify this fingerprint! Would you like to "
"add it to your 'known_hosts' file?")
)
options.append({'widget': lblQuestion, 'retFunc': None})

Expand Down Expand Up @@ -1875,10 +1885,13 @@ def btnIncludeAddClicked(self):
if os.path.islink(path) \
and not (self.cbCopyUnsafeLinks.isChecked()
or self.cbCopyLinks.isChecked()):
if self.questionHandler(
_('"%s" is a symlink. The linked target will not be '
'backed up until you include it, too.\nWould you like '
'to include the symlinks target instead?') % path):

question_msg = _(
'"{path}" is a symlink. The linked target will not be '
'backed up until you include it, too.\nWould you like '
'to include the symlinks target instead?') \
.format(path=path)
if self.questionHandler(question_msg):
path = os.path.realpath(path)

path = self.config.preparePath(path)
Expand Down

0 comments on commit 89cf0d3

Please sign in to comment.