Skip to content

Commit

Permalink
fix: don't swap translation texts when result empty (closes #415)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bnyro committed Mar 12, 2024
1 parent 3e6313c commit 6efb648
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,12 @@ fun TranslationPage(
val temp = viewModel.sourceLanguage
viewModel.sourceLanguage = viewModel.targetLanguage
viewModel.targetLanguage = temp
viewModel.insertedText = viewModel.translation.translatedText
viewModel.translation = Translation("")

if (viewModel.translation.translatedText.isNotEmpty()) {
viewModel.insertedText = viewModel.translation.translatedText
viewModel.translation = Translation("")
}

viewModel.translateNow()
}
) {
Expand Down

0 comments on commit 6efb648

Please sign in to comment.