Skip to content

Commit

Permalink
Adding translation for Yes/No buttons (#811)
Browse files Browse the repository at this point in the history
  • Loading branch information
raivisdejus authored Jun 22, 2024
1 parent 9894760 commit 2d5684c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion buzz/locale/lv_LV/LC_MESSAGES/buzz.po
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ msgstr "Lejupielādē modeli"

#: buzz/widgets/model_download_progress_dialog.py:37
msgid "remaining"
msgstr "!"
msgstr "..."

#: buzz/widgets/menu_bar.py:38
msgid "Import File..."
Expand Down
15 changes: 12 additions & 3 deletions buzz/widgets/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,14 +219,23 @@ def on_clear_history_action_triggered(self):
if len(selected_rows) == 0:
return

reply = QMessageBox.question(
self,
_("Clear History"),
question_box = QMessageBox()
question_box.setWindowTitle(_("Clear History"))
question_box.setIcon(QMessageBox.Icon.Question)
question_box.setText(
_(
"Are you sure you want to delete the selected transcription(s)? "
"This action cannot be undone."
),
)
question_box.setStandardButtons(
QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.No
)
question_box.button(QMessageBox.StandardButton.Yes).setText(_("Ok"))
question_box.button(QMessageBox.StandardButton.No).setText(_("Cancel"))

reply = question_box.exec()

if reply == QMessageBox.StandardButton.Yes:
self.table_widget.delete_transcriptions(selected_rows)

Expand Down
2 changes: 1 addition & 1 deletion tests/widgets/main_window_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def test_should_clear_history_with_rows_selected(
table_widget = self._get_tasks_table(window)
table_widget.selectAll()

with patch("PyQt6.QtWidgets.QMessageBox.question") as question_message_box_mock:
with patch("PyQt6.QtWidgets.QMessageBox.exec") as question_message_box_mock:
question_message_box_mock.return_value = QMessageBox.StandardButton.Yes
window.toolbar.clear_history_action.trigger()

Expand Down

0 comments on commit 2d5684c

Please sign in to comment.