translate: remove redundant translation call
When auto-translate is enabled, translations are saved in cache through preload_event in EventCache so it's redundant and wasteful to call translate() as an async task Closes: https://github.com/damus-io/damus/issues/1940 Lightning-address: kernelkind@getalby.com Signed-off-by: kernelkind <kernelkind@gmail.com> Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
committed by
William Casarin
parent
2be83560bc
commit
7f6540b0c0
@@ -72,15 +72,7 @@ struct TranslateView: View {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func attempt_translation() {
|
||||
guard should_translate(event: event, our_keypair: damus_state.keypair, settings: damus_state.settings, note_lang: self.translations_model.note_language), damus_state.settings.auto_translate else {
|
||||
return
|
||||
}
|
||||
|
||||
translate()
|
||||
}
|
||||
|
||||
func should_transl(_ note_lang: String) -> Bool {
|
||||
should_translate(event: event, our_keypair: damus_state.keypair, settings: damus_state.settings, note_lang: note_lang)
|
||||
}
|
||||
@@ -105,9 +97,6 @@ struct TranslateView: View {
|
||||
Text("")
|
||||
}
|
||||
}
|
||||
.task {
|
||||
attempt_translation()
|
||||
}
|
||||
}
|
||||
|
||||
func translationMeetsStringDistanceRequirements(original: String, translated: String) -> Bool {
|
||||
|
||||
Reference in New Issue
Block a user