Translate notes even if they are in a preferred language but not the current language as that is what users expect

Changelog-Fixed: Translate notes even if they are in a preferred language but not the current language as that is what users expect

Signed-off-by: Terry Yiu <git@tyiu.xyz>
This commit is contained in:
2025-01-19 12:56:40 -05:00
committed by Daniel D’Aquino
parent e8ba1ec806
commit a97532b90d
2 changed files with 5 additions and 7 deletions

View File

@@ -259,11 +259,10 @@ func should_translate(event: NostrEvent, our_keypair: Keypair, note_lang: String
}
if let note_lang {
let preferredLanguages = Set(Locale.preferredLanguages.map { localeToLanguage($0) })
let currentLanguage = localeToLanguage(Locale.current.identifier)
// Don't translate if its in our preferred languages
guard !preferredLanguages.contains(note_lang) else {
// if its the same, give up and don't retry
// Don't translate if the note is in our current language
guard currentLanguage != note_lang else {
return false
}
}