Merge pull request #1065 from rdswift/master

PICARD-1436 Text extraction of "title" and "label" for translation
This commit is contained in:
Philipp Wolfer
2018-12-08 13:27:08 +01:00
committed by GitHub
3 changed files with 17 additions and 5 deletions

View File

@@ -76,7 +76,9 @@ class GeneralOptionsPage(OptionsPage):
self.ui.check_for_updates.setChecked(config.setting["check_for_updates"])
self.ui.update_level.clear()
for level, description in PROGRAM_UPDATE_LEVELS.items():
self.ui.update_level.addItem(_(description['title']), level)
# TODO: Remove temporary workaround once https://github.com/python-babel/babel/issues/415 has been resolved.
babel_415_workaround = description['title']
self.ui.update_level.addItem(_(babel_415_workaround), level)
self.ui.update_level.setCurrentIndex(self.ui.update_level.findData(config.setting["update_level"]))
self.ui.update_check_days.setValue(config.setting["update_check_days"])
else:

View File

@@ -218,7 +218,9 @@ class InterfaceOptionsPage(OptionsPage):
list_item = ToolbarListItem(action)
list_item.setToolTip(_('Drag and Drop to re-order'))
if action in self.TOOLBAR_BUTTONS:
list_item.setText(_(self.TOOLBAR_BUTTONS[action]['label']))
# TODO: Remove temporary workaround once https://github.com/python-babel/babel/issues/415 has been resolved.
babel_415_workaround = self.TOOLBAR_BUTTONS[action]['label']
list_item.setText(_(babel_415_workaround))
list_item.setIcon(icontheme.lookup(self._get_icon_from_name(action), icontheme.ICON_SIZE_MENU))
else:
list_item.setText(self.SEPARATOR)
@@ -287,8 +289,12 @@ class AddActionDialog(QtWidgets.QDialog):
layout = QtWidgets.QVBoxLayout(self)
self.action_list = sorted([[_(self.parent().TOOLBAR_BUTTONS[action]['label']), action]
for action in action_list])
# TODO: Remove temporary workaround once https://github.com/python-babel/babel/issues/415 has been resolved.
babel_415_workaround_list = []
for action in action_list:
babel_415_workaround = self.parent().TOOLBAR_BUTTONS[action]['label']
temp_list.append([_(babel_415_workaround), action])
self.action_list = sorted(babel_415_workaround_list)
self.combo_box = QtWidgets.QComboBox(self)
self.combo_box.addItems([label for label, action in self.action_list])

View File

@@ -144,12 +144,16 @@ class UpdateCheckManager(QtCore.QObject):
webbrowser2.open(self._available_versions[key]['urls']['download'])
else:
if self._show_always:
if self._update_level in PROGRAM_UPDATE_LEVELS:
update_level = PROGRAM_UPDATE_LEVELS[self._update_level]['title']
else:
update_level = N_('unknown')
QMessageBox.information(
self._parent,
_("Picard Update"),
_("There is no update currently available for your subscribed update level: {update_level}\n\n"
"Your version: {picard_old_version}\n").format(
update_level=_(PROGRAM_UPDATE_LEVELS[self._update_level]['title']) if self._update_level in PROGRAM_UPDATE_LEVELS else _('unknown'),
update_level=_(update_level),
picard_old_version=PICARD_FANCY_VERSION_STR,
),
QMessageBox.Ok, QMessageBox.Ok